/* G 主题（nianqi 版）—— 移植自 Typecho 主题 G 3.4.1（youranreus，GPL-3.0），并融合了廿七站点的定制样式。
 * 颜色、圆角、阴影、图片由 theme.toml 的 [options] 控制；想加自己的样式，在站点目录放 static/css/custom.css 即可。
 * SPDX-License-Identifier: GPL-3.0-only */

@keyframes opacity-in { from { opacity: 0 } to { opacity: 1 } }

* { transition: color .2s, background .2s; -webkit-tap-highlight-color: transparent }

html {
  font-size: 18px;
  font-weight: 400;
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  --serif: "Source Han Serif CN", "Source Han Serif SC", "Source Han Serif", "Noto Serif CJK SC", "Noto Serif SC", "Songti SC", "SimSun", serif;
  --theme-text-main: #000;
  --theme-bg-main: #fff;
  --theme-text-strong: #cc3536;
  --theme-text-code: #dd4a68;
  --theme-bg-sub: #f4f5f5;
  --theme-text-blockq-bg: rgba(245, 245, 245, .5);
  --theme-text-blockq: #878c93;
  --theme-table-th-bg: #f8f8f8;
  --theme-table-td-bg: #fff;
  --theme-table-td-bg-even: #f8f8f8;
  --theme-table-tr-border: #ccc;
  --theme-table-td-border: #ddd;
  --theme-banner-bg: #fafafa;
  --theme-banner-title: #333;
  --theme-pap-text-main: #202020;
  --pill-bg: rgba(255, 255, 255, .99);
  --pill-border: #eee;
}

html::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  width: 100%;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center 0;
}

body { margin: 0; padding: 0; font-family: var(--serif) }

a { text-decoration: none; color: var(--theme-color, #07f) }
button { font: inherit }
img { border: 0 }
.clear { display: block; clear: both }
.clear::before, .clear::after { display: block; clear: both; content: "" }
.left { float: left }
.right { float: right }

/* ---------- 页面骨架 ---------- */
#main { width: 800px; margin: 50px auto; position: relative; right: 0; transition: right .3s }
#container { width: 800px; margin: auto; animation: opacity-in 1s ease }

#header {
  padding: 40px;
  border-radius: var(--theme-radius, 30px);
  background: var(--header-color, #6a6a6a);
  box-shadow: var(--theme-shadow, none);
  color: #fff;
  margin-bottom: 50px;
  position: relative;
  overflow: hidden;
}
#header-title { position: relative; z-index: 2 }
#header-title h2 { padding: 0; font-weight: 200; font-size: 2rem; margin: 0 0 1.125rem }
#header-title h2 a { color: inherit }
#header-content { position: relative; display: flex; align-items: flex-start; justify-content: space-between; z-index: 2 }
#header-content-left p { color: hsla(0, 0%, 100%, .6); margin: 0 }
#header-content-right nav a { position: relative; display: inline-block; color: hsla(0, 0%, 100%, .6); margin-left: .5rem; transition: color .2s }
#header-content-right nav a:hover, #header-content-right nav a.nav-focus { color: #fff }
#header-content-right nav a.nav-focus::before,
#footer-nav a.nav-focus::before {
  content: " ";
  display: block;
  position: absolute;
  height: 5px;
  width: 5px;
  background: #fff;
  top: -5px;
  right: -5px;
  border-radius: 1000rem;
  opacity: .7;
}
#header-background { position: absolute; bottom: 0; right: 0; opacity: .5; z-index: 1; max-height: 20rem; user-select: none; pointer-events: none }

footer {
  padding: 30px 40px;
  border-radius: var(--theme-radius, 30px);
  background: var(--header-color, #6a6a6a);
  box-shadow: var(--theme-shadow, none);
  color: hsla(0, 0%, 100%, .8);
  margin-top: 50px;
  font-size: .875rem;
}
footer p { margin: 0 }
#footer-content { display: flex; justify-content: space-between; margin-bottom: 8px }
#footer-nav { text-align: right }
#footer-nav a { position: relative; display: inline-block; color: #fff; margin-left: 5px; transition: all .2s }
#footer-nav a:hover { transform: translateY(-2px) }
#footer-sponsor img { height: 1.35rem; margin-right: 5px }
a.icp { color: hsla(0, 0%, 100%, .8) }

/* ---------- 文章列表 ---------- */
#articles { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap }
.article-item {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  margin-bottom: 20px;
  padding: 30px;
  background: var(--theme-bg-main);
  box-shadow: var(--theme-shadow, none);
  border-radius: var(--theme-radius, 30px);
  transition: transform .2s ease;
  overflow: hidden;
}
.article-item:hover { transform: scale(1.01) }
.article-item p { color: var(--theme-text-main); font-size: .875rem; z-index: 2; position: relative; overflow-wrap: break-word }
.article-banner-wrap {
  position: absolute;
  height: 100%;
  width: 50%;
  right: 0;
  top: 0;
  z-index: 1;
  background: linear-gradient(to left, transparent, #fff);
}
.article-banner {
  position: absolute;
  height: 100%;
  width: 50%;
  right: 0;
  top: 0;
  z-index: 0;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  -webkit-mask-image: linear-gradient(to left, rgba(0, 0, 0, .5), rgba(0, 0, 0, .21) 50%, rgba(0, 0, 0, .17));
  mask-image: linear-gradient(to left, rgba(0, 0, 0, .5), rgba(0, 0, 0, .21) 50%, rgba(0, 0, 0, .17));
}
.article-title {
  position: relative;
  z-index: 2;
  font-size: 1.25rem;
  margin: 0 0 .875rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--theme-color, #07f);
}
.article-data { position: relative; z-index: 2; display: flex; justify-content: space-between; gap: 1rem }
.article-data span { opacity: .8; font-weight: 600; font-size: .925rem; color: var(--theme-text-main) }
.article-data span a { color: var(--theme-text-main) }
.article-empty p { text-align: center; opacity: .7; margin: 0 }

a.next, a.prev {
  font-size: .875rem;
  background: var(--pill-bg);
  padding: 10px 20px;
  border-radius: 1000rem;
  border: 1px solid var(--pill-border);
  box-shadow: var(--theme-shadow, none);
  transition: transform .2s ease;
  color: var(--theme-text-main);
}
a.next { float: right }
a.prev { float: left }
a.next:hover, a.prev:hover { transform: scale(.99) }

h3.archive-title {
  font-weight: 400;
  text-align: center;
  margin: 0 0 2rem;
  text-shadow: 0 3px 6px rgba(255, 255, 255, .3);
  color: var(--theme-text-main);
  opacity: .8;
}

/* ---------- 文章 / 独立页面 ---------- */
.PAP {
  background: var(--theme-bg-main);
  box-shadow: var(--theme-shadow, none);
  border-radius: var(--theme-radius, 30px);
  overflow: hidden;
  animation: opacity-in 1s ease;
}
.PAP-banner {
  min-height: 15.5rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  background: var(--theme-banner-bg);
}
.PAP-banner div { width: 100%; padding: 1.5rem 0 }
.PAP-banner div h1 {
  font-size: 2rem;
  color: var(--theme-banner-title);
  font-weight: 200;
  text-align: center;
  line-height: 1.33;
  max-width: 80%;
  margin: 0 auto;
}
.PAP-banner div p { color: var(--theme-text-main); margin: .5rem 0 0; padding: 0 1rem; font-size: .725rem; text-align: center; opacity: .4 }
.PAP-banner div p a { color: inherit }

.PAP-content { font-size: .875rem }
.PAP-content:last-child { margin-bottom: 2rem }
.post-content { font-size: 20px }
.PAP-content > * { max-width: 100% }
.PAP-content > :first-child { margin-top: 1.5rem }
.PAP-content p {
  margin: 0 1.5rem 1.25rem;
  position: relative;
  font-weight: 400;
  text-align: justify;
  color: var(--theme-pap-text-main);
  overflow-wrap: break-word;
  line-height: 1.8;
  letter-spacing: .03rem;
}
.PAP-content h1, .PAP-content h2, .PAP-content h3, .PAP-content h4 {
  color: var(--theme-text-main);
  font-weight: 400;
  margin: 2rem 1.5rem 1.25rem;
  cursor: pointer;
  position: relative;
  scroll-margin-top: 1.5rem;
}
.PAP-content h1 { font-size: 1.5rem }
.PAP-content h2 { font-size: 1.35rem }
.PAP-content h3, .PAP-content h4 { font-size: 1.15rem }
.PAP-content h1::after, .PAP-content h2::after, .PAP-content h3::after, .PAP-content h4::after {
  content: " ";
  display: block;
  height: 3px;
  width: 3rem;
  background-color: #eee;
  opacity: .6;
  position: absolute;
  bottom: -.5rem;
}
.PAP-content h1::before, .PAP-content h2::before, .PAP-content h3::before, .PAP-content h4::before {
  content: "🔖";
  position: absolute;
  zoom: .8;
  right: 2rem;
  top: 0;
  opacity: 0;
  transition: opacity .2s;
}
.PAP-content h1:hover::before, .PAP-content h2:hover::before, .PAP-content h3:hover::before, .PAP-content h4:hover::before { opacity: .2 }
.PAP-content h5, .PAP-content h6 { color: var(--theme-text-main); margin: 0 1.5rem 1.25rem; font-weight: 400; font-size: 1rem }
.PAP-content ul, .PAP-content ol { margin: 1.5rem; padding-left: 40px }
/* 嵌套列表不再叠加外边距（原主题会让子列表上下各空出 1.5rem） */
.PAP-content li > ul, .PAP-content li > ol { margin: .25rem 0 }
.PAP-content li { text-align: justify; color: var(--theme-pap-text-main); overflow-wrap: break-word; line-height: 1.8; letter-spacing: .013rem }
.PAP-content blockquote {
  margin: 1.5rem 0;
  color: var(--theme-text-blockq);
  padding: .5rem 1.5rem;
  line-height: 1.8;
  position: relative;
  background: var(--theme-text-blockq-bg);
}
.PAP-content blockquote p { color: #878c93; margin-bottom: 0; margin-left: 0 }
.PAP-content blockquote::before { content: ""; height: 100%; width: 5px; background: #ddd; display: block; position: absolute; left: 0; top: 0 }
.PAP-content hr {
  overflow: hidden;
  margin: 1rem 0;
  padding: 0;
  height: .125rem;
  border: none;
  background: #e7e7e7 repeating-linear-gradient(-45deg, #fff, #fff .25rem, transparent .25rem, transparent .5rem);
}
.PAP-content strong { color: var(--theme-text-strong) }
.PAP-content img { display: block; max-width: 100%; height: auto; margin: 0 auto; cursor: zoom-in }
.PAP-content a { overflow-wrap: anywhere }
.PAP-content table {
  border-collapse: collapse;
  border-spacing: 0;
  display: block;
  overflow: auto;
  box-sizing: border-box;
  width: calc(100% - 3rem);
  margin: 1.5rem auto;
  line-height: 1.7;
  font-size: .8rem;
}
.PAP-content table th { font-weight: 700; padding: .575rem .875rem; border: 1px solid var(--theme-table-td-border); background: var(--theme-table-th-bg) }
.PAP-content table td { padding: .575rem .875rem; border: 1px solid var(--theme-table-td-border) }
.PAP-content table tr { border-top: 1px solid var(--theme-table-tr-border); background-color: var(--theme-table-td-bg) }
.PAP-content table tr:nth-child(2n) { background-color: var(--theme-table-td-bg-even) }
.PAP-content code { font-family: "JetBrains Mono", Monaco, "Courier New", Consolas, monospace; margin: 0 4px; overflow-wrap: break-word; color: var(--theme-text-code); font-size: 14px }
.PAP-content pre { background: #343232; color: #f0f0f0; margin: 1.5rem; padding: 1rem 1.25rem; overflow: auto; line-height: 1.6; border-radius: 4px }
.PAP-content pre code { color: inherit; margin: 0 }
.PAP-content audio, .PAP-content video, .PAP-content iframe { display: block; max-width: calc(100% - 3rem); margin: 1.5rem auto }
.PAP-content .footnote-definition { font-size: .8em; margin: 0 1.5rem .5rem; opacity: .8 }
.PAP-content .footnote-definition p { display: inline; margin: 0 }

#post-nav { display: flex; justify-content: space-between; gap: 24px; margin: 28px 1.5rem 4px }
.post-nav-link { display: inline-block; text-decoration: none; font-size: 15px; line-height: 1.5; color: var(--theme-text-main, #000) }
/* 文章上下篇是纯文字链接，不套用分页按钮（a.prev / a.next）的胶囊样式，与原站一致 */
#post-nav .post-nav-link, #post-nav .post-nav-link:hover {
  border: none; background: transparent; box-shadow: none; padding: 0; border-radius: 0; float: none; transform: none; font-size: 15px
}
/* 原站的上下篇链接同时命中 a.prev / a.next 的字号（.875rem） */
#post-nav a.post-nav-link { font-size: .875rem }
.post-nav-link:hover { color: var(--theme-color, #000080) }
.post-nav-link.disabled { opacity: .4; pointer-events: none }
.post-nav-link.prev { text-align: left }
.post-nav-link.next { text-align: right; margin-left: auto }

#post-toolbar { margin: 1.5rem }
.post-toolbar-btn {
  display: inline-block;
  background: #f4f5f5;
  border: none;
  padding: .438rem .825rem;
  font-size: .875rem;
  font-weight: 600;
  border-radius: 5px;
  color: var(--theme-color);
  transition: background .2s;
  cursor: pointer;
  text-align: left;
}
.post-toolbar-btn:hover { background: #eceded }
.post-toolbar-btn.agreed .agree-num::before { content: "♥ " }
.agree-num { margin-left: .25rem }
.legal-link { text-align: center; margin-top: 8px }
.legal-link a { display: inline-block; transition: transform .25s ease }
.legal-link a:hover { transform: scale(1.15) }

#post-footer { font-size: .625rem; display: flex; justify-content: space-between; margin: 1.5rem }
#post-footer p { color: var(--theme-text-main); margin: 0; opacity: .7 }
#post-footer-tag p a { padding: 8px 15px; background-color: #f5f5f5; color: #777; border-radius: 1000rem }

/* ---------- 归档页 ---------- */
#archives-content { margin: 1.5rem }
#archives-content .archives-intro { margin: 0 -1.5rem }
#tag-cloud { width: 100%; line-height: 50px; padding: 0; margin: 0 }
#tag-cloud li { list-style-type: none; display: inline-block }
#tag-cloud li a { font-size: .625rem; color: #777; padding: 8px 15px; margin: .1rem; transition: all .24s ease; background: rgba(241, 243, 244, .7); border-radius: 10000rem }
#tag-cloud li a:hover { background: #f1f3f4 }
#timeline { margin: 40px auto; color: #787878 }
#timeline .year-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 2.3rem;
  font-weight: bold;
  text-align: left;
  color: #333;
  margin: 26px 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 0, 0, .05);
}
#timeline .archive-year:first-child .year-title { margin-top: 0 }
#timeline .year-title .year-text { font-size: .9em; font-weight: 500; color: #000; white-space: nowrap }
#timeline .archive-list { list-style: none; padding: 0; margin: 0 }
#timeline .archive-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px dashed #eee }
#timeline .archive-item a { color: #333; text-decoration: none; min-width: 0; overflow-wrap: anywhere }
#timeline .archive-item a:hover { text-decoration: underline }
#timeline .archive-date { color: inherit; opacity: .78; font-size: .9em; white-space: nowrap; line-height: 1 }

/* ---------- 右下角工具栏 ---------- */
#toolbar { z-index: 999; position: fixed; bottom: 1.5rem; right: 1.5rem }
#toolbar-container { width: 3rem; height: auto }
.toolbar-btn {
  display: block;
  height: 2.5rem;
  width: 2.5rem;
  box-sizing: border-box;
  padding: calc(.5rem - 2px);
  border-radius: 10000rem;
  background: var(--theme-bg-main);
  margin-top: .5rem;
  cursor: pointer;
  opacity: .5;
  transition: opacity .2s;
  border: 1px solid #eee;
  line-height: 0;
}
.toolbar-btn:hover, .toolbar-btn:focus-visible { opacity: 1 }
.toolbar-btn svg { height: 1.5rem; width: 1.5rem }
.toolbar-btn svg path { fill: var(--theme-text-main); opacity: .7 }

/* ---------- 目录 ---------- */
#toc {
  position: fixed;
  z-index: 3;
  right: -15rem;
  top: 0;
  width: 15rem;
  height: 100vh;
  background: var(--theme-banner-bg);
  transition: right .3s;
  color: var(--theme-text-main);
  box-shadow: var(--theme-shadow);
  visibility: hidden;
}
#toc.toc-show { right: 0; visibility: visible }
#main.toc-show-main { right: 5rem }
#toc-container { box-sizing: border-box; padding: 1.5rem; margin-left: 1.5rem; max-height: 100%; overflow-y: auto; direction: rtl }
#toc-container h3 { font-size: 1.5rem; margin-top: 0; direction: ltr; text-align: left }
#toc-close {
  position: absolute;
  top: 50%;
  left: 0;
  padding: .5rem .5rem .5rem 0;
  border: 0;
  border-top-right-radius: 1000rem;
  border-bottom-right-radius: 1000rem;
  background: var(--theme-bg-main);
  cursor: pointer;
  line-height: 0;
}
#toc-close svg { width: 2rem; height: 2rem }
#toc-close svg path { fill: var(--theme-text-main); opacity: .8 }
.toc-list { padding: 0; margin: 0; direction: ltr }
.toc-list li { font-size: .875rem; list-style-type: none; line-height: 2; border-radius: 5px; transition: transform .2s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.toc-list li a { color: var(--theme-text-main) }
.toc-list li:hover { transform: translateX(.5rem) }
.toc-list .toc-level-3 { padding-left: 1em }
.toc-list .toc-level-4 { padding-left: 2em }
.toc-list li.is-active-li { font-weight: 600 }

/* ---------- 左侧栏 ---------- */
#sliderbar {
  position: fixed;
  left: -16rem;
  top: 0;
  width: 15rem;
  z-index: 999;
  max-height: 100%;
  overflow-y: auto;
  padding-bottom: 100px;
  box-sizing: border-box;
  scrollbar-width: none;
  transition: left .3s linear;
}
#sliderbar::-webkit-scrollbar { display: none }
#sliderbar.move-left { left: -16rem }
#sliderbar.move-right { left: 10px }
#sliderbar-cover {
  position: fixed;
  inset: 0;
  z-index: 998;
  background: rgba(75, 85, 99, .5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .5s ease, visibility .5s;
}
#sliderbar-cover.sliderbar-cover__show { opacity: 1; visibility: visible }
.sliderbar-content, #widgets .widget {
  margin: 10px 0;
  background: var(--theme-bg-main);
  box-shadow: var(--theme-shadow);
  border-radius: 15px;
  overflow: hidden;
  color: var(--theme-text-main);
}
.profile-content { position: relative }
.profile-content h4 { text-align: center; font-size: 1.25rem; margin: 70px 0 10px; opacity: .7; font-weight: 600 }
.profile-content i { display: block; padding: 10px 0; background: var(--theme-banner-bg); width: 100%; text-align: center; color: #9a9a9a; font-size: .875rem; font-weight: 100 }
.profile-cover {
  width: 100%;
  height: 100px;
  background-color: #000;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  filter: grayscale(20%);
  opacity: .5;
}
.profile-avatar-container { text-align: center; position: absolute; top: 50px; z-index: 2; width: 100% }
.profile-avatar-container img { width: 100px; height: 100px; border-radius: 100%; border: 2px solid rgba(255, 255, 255, .8); object-fit: cover }
.profile-meta { margin: 10px 0 15px }
.profile-meta > div { width: 33.3%; float: left; text-align: center }
.profile-meta p { margin: 10px 0 0; font-size: .875rem }
.profile-meta span { font-weight: 600; opacity: .6; font-size: .625rem }

#widgets { display: flex; flex-wrap: wrap; justify-content: space-between }
#widgets .category-list { box-sizing: border-box; width: 15rem; max-width: 100%; height: auto; padding: 0 }
#widgets .category-content {
  --rows: 8;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(var(--rows), auto);
  grid-auto-columns: auto;
  justify-content: stretch;
  margin: 0;
  padding: 0;
  list-style: none;
}
#widgets .category-content li { display: block; min-width: 0; margin: 0; list-style: none }
#widgets .category-content li a {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: .66rem 2px;
  font-size: .875rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--theme-text-main);
  transition: .2s ease all;
}
#widgets .category-content li a:hover { color: #fff; background: var(--theme-color) }

/* ---------- 搜索 ---------- */
#search-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  background: rgba(75, 85, 99, .5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: opacity-in .2s;
}
#search-modal[hidden] { display: none }
.search-box {
  box-sizing: border-box;
  width: min(600px, 92vw);
  max-height: 76vh;
  display: flex;
  flex-direction: column;
  background: var(--theme-bg-main);
  color: var(--theme-text-main);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .2);
  border-radius: var(--theme-radius, 8px);
  padding: 1.25rem;
}
.search-form { display: flex; gap: .5rem }
.search-form input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1rem;
  padding: .6rem .8rem;
  border: 1px solid #ddd;
  border-radius: 5px;
  background: var(--theme-bg-main);
  color: var(--theme-text-main);
  outline: none;
}
.search-form input:focus { border-color: var(--theme-color) }
.search-form button {
  font-size: .9rem;
  padding: 0 1.1rem;
  border: 0;
  border-radius: 5px;
  background: var(--theme-color);
  color: #fff;
  cursor: pointer;
}
.search-results { list-style: none; margin: .75rem 0 0; padding: 0; overflow-y: auto }
.search-results:empty { display: none }
.search-results li a { display: block; padding: .6rem .5rem; border-bottom: 1px dashed #eee; color: var(--theme-text-main) }
.search-results li a:hover, .search-results li a:focus { background: var(--theme-bg-sub) }
.search-results .r-title { display: block; color: var(--theme-color); font-size: .95rem; font-weight: 600 }
.search-results .r-meta { display: block; font-size: .7rem; opacity: .6; margin-top: .2rem }
.search-results .r-snippet { display: block; font-size: .8rem; opacity: .85; margin-top: .3rem; line-height: 1.6 }
.search-results mark { background: rgba(255, 196, 0, .35); color: inherit }
.search-results .r-more a { text-align: center; font-size: .85rem; color: var(--theme-color) }
.search-results .r-empty { padding: .8rem .5rem; font-size: .85rem; opacity: .7 }
.search-tip { margin: .75rem 0 0; font-size: .7rem; opacity: .5 }
.search-page { padding: 1.5rem 1.5rem .5rem }
.search-page .search-form { margin: 0 0 1.25rem }
.search-page .search-hint { margin: 0 0 .75rem; font-size: .85rem; opacity: .7 }
.search-cats { list-style: none; padding: 0; margin: 0 0 1.5rem; display: flex; flex-wrap: wrap; gap: .5rem }
.search-cats li a { display: inline-block; padding: .3rem .8rem; border-radius: 1000rem; background: var(--theme-bg-sub); color: var(--theme-text-main); font-size: .8rem }
.search-cats li span { font-size: .65rem; opacity: .5; margin-left: .2rem }

/* ---------- 提示 ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  z-index: 1001;
  transform: translate(-50%, 1rem);
  background: var(--theme-bg-main);
  color: var(--theme-text-main);
  font-size: .875rem;
  font-weight: 600;
  padding: .438rem .825rem;
  box-shadow: var(--theme-shadow), 0 0 0 1px rgba(0, 0, 0, .04);
  border-radius: 5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0) }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  html { font-size: 17px }
  #header-title h2 { font-size: 1.5rem }
}
@media (max-width: 830px) {
  html { font-size: 16px }
  #main { width: 95%; margin: 20px auto }
  #container { width: 100% }
  .article-item { width: 100%; padding: 1.5rem }
  #header { margin-bottom: 20px; padding: 25px }
  #header-content { display: block }
  #header-content-right { margin-top: 20px; text-align: center }
  .PAP-banner { min-height: 13.5rem }
  .PAP-banner div h1 { font-size: 1.2rem }
  #post-footer-modified { display: none }
  #footer-content { margin-bottom: 10px; flex-wrap: wrap }
  #footer-nav { margin-top: 10px; text-align: left }
  #footer-nav a { margin: 0 5px 0 0 }
  #footer-sponsor img { position: relative; bottom: -4px }
  footer { padding: 15px 25px 25px }
  #toolbar { bottom: 10rem; right: .5rem }
  #main.toc-show-main { right: 0 }
  #timeline .year-title { font-size: 1.8rem }
}

/* ---------- 夜间模式 ---------- */
html.dark {
  --theme-text-main: rgba(249, 249, 249, .8);
  --theme-bg-main: #2c2a2a;
  --theme-text-strong: rgb(204, 53, 54);
  --theme-bg-sub: #383737;
  --theme-text-blockq-bg: #383737;
  --theme-table-th-bg: #383737;
  --theme-table-td-bg: #2c2a2a;
  --theme-table-td-bg-even: #383737;
  --theme-table-tr-border: #2c2a2a;
  --theme-table-td-border: #403e3e;
  --theme-banner-bg: #343232;
  --theme-banner-title: #fff;
  --theme-pap-text-main: rgba(249, 249, 249, .8);
  --header-color: #2c2a2a;
  --pill-bg: rgba(22, 22, 26, .99);
  --pill-border: rgba(255, 255, 255, .08);
  color-scheme: dark;
}
html.dark #dark-cover { position: fixed; background: rgba(0, 0, 0, .8); width: 100vw; height: 100vh; top: 0; left: 0; z-index: -1 }
html.dark .article-banner-wrap, html.dark .article-banner { display: none }
html.dark .article-title, html.dark .article-title a { color: #fff }
html.dark .toolbar-btn { border-color: #555 }
html.dark .post-toolbar-btn { background-color: #403e3e }
html.dark .post-toolbar-btn:hover { background-color: #4a4848 }
html.dark #post-footer-tag p a, html.dark #tag-cloud li a { background-color: #403e3e; color: #f0f0f0 }
html.dark .PAP-content hr { background: #2c2a2a repeating-linear-gradient(-45deg, #bcbcbc, #bcbcbc .25rem, transparent .25rem, transparent .5rem) }
html.dark .PAP-content h1::after, html.dark .PAP-content h2::after, html.dark .PAP-content h3::after, html.dark .PAP-content h4::after { background-color: #555 }
html.dark #timeline { color: var(--theme-text-main) }
html.dark #timeline .year-title { color: var(--theme-text-main); border-bottom-color: #3a3a3a }
html.dark #timeline .year-title .year-text { color: var(--theme-text-main) }
html.dark #timeline .archive-item a { color: var(--theme-text-main) }
html.dark #timeline .archive-date { color: #ccc }
html.dark #timeline .archive-item { border-bottom: 1px dashed rgba(255, 255, 255, .7) }
html.dark .search-form input { border-color: #555 }
html.dark .search-results li a { border-bottom-color: #444 }
html.dark .PAP-content img { opacity: .9 }
/* 原主题夜间模式下链接仍是深蓝色，几乎看不清；这里提亮一点 */
html.dark .PAP-content a, html.dark .legal-link a, html.dark .post-toolbar-btn, html.dark .search-results .r-title { color: #a9b4ff }

@media print {
  html::before, #toolbar, #toc, #sliderbar, #sliderbar-cover, #search-modal, #header-background, .article-banner, .article-banner-wrap, #post-toolbar, #post-nav { display: none !important }
  #main { width: auto; margin: 0 }
  .PAP, #header, footer { box-shadow: none }
}

/* ===== 评论区 ===== */
#comments { margin: 2.5rem 1.5rem 1rem; color: var(--theme-text-main) }
#comments p { margin: 0 }
.comments-title { font-size: 1.125rem; font-weight: 600; margin: 0 0 1.25rem; padding-bottom: .5rem; border-bottom: 1px solid var(--theme-table-tr-border); display: flex; align-items: center; gap: .5rem }
.comments-count { font-size: .75rem; font-weight: normal; line-height: 1.5rem; min-width: 1.5rem; padding: 0 .5rem; text-align: center; border-radius: 1rem; background: var(--theme-bg-sub) }
.comments-empty, .comments-closed { font-size: .875rem; color: var(--theme-text-blockq); margin: 1rem 0 }
.comment-list, .comment-children { list-style: none; margin: 0; padding: 0 }
.comment-children { margin-left: 2.75rem }
.comment-item { margin: 0 }
.comment-body { display: flex; gap: .875rem; padding: .9rem 0; border-bottom: 1px dashed var(--theme-table-td-border) }
.comment-avatar { flex: 0 0 auto; width: 2.75rem; height: 2.75rem; border-radius: 50%; object-fit: cover; background: var(--theme-bg-sub) }
.comment-content { flex: 1 1 auto; min-width: 0; font-size: .875rem; line-height: 1.75 }
.comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .75rem; font-size: .8125rem }
.comment-author { font-style: normal; font-weight: 600; color: var(--theme-text-main) }
.comment-author a { color: var(--theme-color) }
.comment-author a:hover { text-decoration: underline }
.comment-by-author .comment-author::after { content: "作者"; margin-left: .4rem; padding: 0 .35rem; font-size: .6875rem; font-weight: normal; line-height: 1.1rem; color: #fff; background: var(--theme-color); border-radius: .2rem; vertical-align: 1px }
.comment-date { font-size: .75rem; color: var(--theme-text-blockq) }
.comment-waiting { margin: .25rem 0 0; font-size: .75rem; color: var(--theme-text-strong) }
.comment-text { margin-top: .35rem; word-break: break-word }
.comment-text p { margin: .45rem 0 }
.comment-text pre { overflow-x: auto; padding: .6rem .8rem; background: var(--theme-bg-sub); border-radius: var(--theme-radius, 0) }
.comment-text img { max-width: 100%; height: auto }
.comment-text blockquote { margin: .5rem 0; padding: .3rem .8rem; color: var(--theme-text-blockq); background: var(--theme-text-blockq-bg); border-left: 3px solid var(--theme-table-td-border) }
.comment-actions { margin-top: .3rem; font-size: .75rem }
.comment-reply-link { color: var(--theme-color) }
.comment-reply-link:hover { text-decoration: underline }
.comment-pager { display: flex; flex-wrap: wrap; justify-content: center; gap: .375rem; margin: 1.25rem 0 0 }
.comment-pager a { padding: .15rem .65rem; font-size: .8125rem; border-radius: 1000rem; background: var(--theme-bg-sub); color: var(--theme-text-main) }
.comment-pager a.current { background: var(--theme-color); color: #fff }
.comment-respond { margin-top: 2rem }
.comment-respond-title { margin: 0 0 .75rem; font-size: 1rem; font-weight: 600 }
.comment-replying { margin-bottom: .5rem; font-size: .8125rem; color: var(--theme-text-blockq) }
.comment-replying[hidden] { display: none }
.comment-logged { margin-bottom: .5rem; font-size: .8125rem; color: var(--theme-text-blockq) }
.comment-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem .75rem; margin-bottom: .75rem }
.comment-field { display: flex; flex-direction: column; gap: .25rem; font-size: .75rem; color: var(--theme-text-blockq) }
.comment-field input { min-width: 0; padding: .4rem .5rem; font: inherit; font-size: .875rem; color: var(--theme-text-main); background: var(--theme-bg-main); border: 1px solid var(--theme-table-td-border); border-radius: var(--theme-radius, 0) }
.comment-textarea { margin: 0 }
.comment-textarea textarea { display: block; box-sizing: border-box; width: 100%; min-height: 7rem; resize: vertical; padding: .6rem .7rem; font: inherit; font-size: .875rem; line-height: 1.7; color: var(--theme-text-main); background: var(--theme-bg-main); border: 1px solid var(--theme-table-td-border); border-radius: var(--theme-radius, 0) }
.comment-field input:focus, .comment-textarea textarea:focus { outline: 0; border-color: var(--theme-color) }
.comment-submit { margin-top: .75rem; text-align: right }
.comment-btn { padding: .45rem 1.4rem; font-size: .875rem; color: #fff; background: var(--theme-color); border: 0; border-radius: 1000rem; cursor: pointer }
.comment-btn:hover { opacity: .88 }
@media (max-width: 830px) {
    #comments { margin: 2rem .75rem 1rem }
    .comment-children { margin-left: 1rem }
    .comment-fields { grid-template-columns: 1fr }
}
