/* Slim主题 样式 */
:root {
  --page-max-width: 840px;
  --reading-max-width: 720px;
  --background-body: #fff;
  --background-elevated: #f6f8fa;
  --background-header: #ffffffd1;
  --pixel-hero-bg: #fff;
  --pixel-hero-opacity: 0.5;
  --text-primary: #1f2328;
  --text-secondary: #4d5761;
  --text-muted: #6e7781;
  --accent: #0969da;
  --black: 31, 35, 40;
  --gray: 110, 119, 129;
  --gray-light: 234, 238, 242;
  --gray-dark: 77, 87, 97;
  --section-gap-y: 1.5rem;
  --section-gap-x: 1.25rem;
  --radius-ui: 6px;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.625rem;
  --text-3xl: 1.75rem;
  --weight-regular: 400;
  --weight-bold: 700;
  --font-family-text: "LXGW WenKai Screen", "Noto Serif SC", "Source Han Serif SC", "Source Han Serif CN", "Songti SC", "STSong", "SimSun", serif;
  --font-family-mono: "Cascadia Code", "Cascadia Mono", "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Sarasa Term SC", "Sarasa Mono SC", "Noto Sans Mono CJK SC", "Source Han Mono SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei UI", monospace;
  --line-height-tight: 1.2;
  --line-height-body: 1.7;
  --line-height-heading: 1.3;
  --line-height-compact: 1.5;
  --list-row-gap: 0.85rem;
  --gap-sm: 0.5rem;
  --gap-md: 0.7rem;
  --gap-lg-plus: 1rem;
}

html.dark {
  --background-body: #151819;
  --background-elevated: #202428;
  --background-header: #151819d6;
  --pixel-hero-bg: #0a0a0a;
  --text-primary: #e6edf3;
  --text-secondary: #c2c9d0;
  --text-muted: #8b949e;
  --accent: #39d353;
  --black: 230, 237, 243;
  --gray: 139, 148, 158;
  --gray-light: 39, 44, 49;
  --gray-dark: 194, 201, 208;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background-body);
  color-scheme: light;
  overflow-y: scroll;
}

html.dark {
  color-scheme: dark;
}

@supports (scrollbar-gutter: stable) {
  html {
    scrollbar-gutter: stable;
    overflow-y: auto;
  }
}

body {
  background: var(--background-body);
  min-height: 100vh;
  color: var(--text-secondary);
  font-family: var(--font-family-text);
  font-size: var(--text-sm);
  line-height: var(--line-height-body);
  overflow-wrap: break-word;
  flex-direction: column;
  margin: 0;
  display: flex;
  overflow-x: clip;
}

main {
  width: var(--page-max-width);
  flex: 1;
  max-width: calc(100% - 2rem);
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

main>section {
  min-width: 0;
}

main>section+section {
  margin-top: var(--section-gap-y);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-primary);
  font-family: inherit;
  line-height: var(--line-height-heading);
  margin: 0 0 0.5rem;
}

h1 {
  font-size: var(--text-2xl);
}

h2 {
  font-size: var(--text-xl);
}

h3 {
  font-size: var(--text-lg);
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

button,
input,
textarea {
  font: inherit;
}

img {
  border-radius: var(--radius-ui);
  max-width: 100%;
  height: auto;
  display: block;
}

hr {
  display: none;
}

code {
  border-radius: var(--radius-ui);
  background: var(--background-elevated);
  color: var(--text-primary);
  font-family: var(--font-family-mono);
  font-size: inherit;
  font-weight: var(--weight-regular);
  font-variant-ligatures: none;
  border: 0;
  padding: 0.12em 0.35em;
}

pre {
  border-radius: var(--radius-ui);
  background: var(--background-elevated);
  font-family: var(--font-family-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  font-variant-ligatures: none;
  line-height: var(--line-height-compact);
  tab-size: 2;
  border: 0;
  padding: 1rem;
  overflow-x: auto;
}

pre>code {
  color: inherit;
  font: inherit;
  background: 0 0;
  padding: 0;
  display: block;
}

/* shiki 语法高亮（明暗主题联动） */
pre.shiki,
pre.shiki span {
  color: var(--shiki-light);
}

/*pre.shiki { background-color: var(--shiki-light); }*/
html.dark pre.shiki,
html.dark pre.shiki span {
  color: var(--shiki-dark) !important;
}

/*html.dark pre.shiki { background-color: var(--shiki-dark) !important; }*/
pre.shiki code {
  background: 0 0;
}

pre.shiki .line {
  min-height: var(--line-height-compact);
}

blockquote {
  border-left: 2px solid var(--accent);
  color: var(--text-muted);
  background: 0 0;
  margin: 1.25rem 0;
  padding: 0 0 0 1rem;
}

blockquote> :last-child {
  margin-bottom: 0;
}

table {
  border-collapse: separate;
  border-spacing: 0 0.35rem;
  width: 100%;
}

th,
td {
  text-align: left;
  border: 0;
  padding: 0.35rem 0.65rem;
}

.sr-only {
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  position: absolute !important;
}

@media (prefers-reduced-motion: reduce) {

  *,
  :before,
  :after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ---------- pixel hero 特效画布 ---------- */
.pixel-hero-canvas {
  z-index: -1;
  background: var(--pixel-hero-bg);
  width: 100vw;
  height: 100vh;
  opacity: var(--pixel-hero-opacity);
  pointer-events: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
}

html:has(.pixel-hero-canvas),
body:has(.pixel-hero-canvas) {
  background: var(--pixel-hero-bg);
}

body:has(.pixel-hero-canvas) {
  isolation: isolate;
}

/* ---------- 页头 ---------- */
.site-header {
  --header-icon-size: 1.125rem;
  --header-icon-stroke: 2;
  z-index: 100;
  background: var(--background-header);
  backdrop-filter: saturate(150%) blur(12px);
  position: sticky;
  top: 0;
}

.header-inner {
  width: var(--page-max-width);
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  max-width: calc(100% - 2rem);
  min-height: 3.5rem;
  margin: 0 auto;
  display: grid;
}

.brand-lockup {
  white-space: nowrap;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
  margin: 0;
  display: flex;
  text-decoration: none;
}

.brand {
  color: var(--text-primary);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  line-height: var(--line-height-compact);
  white-space: nowrap;
  padding: 0.4rem 0;
  text-decoration: none;
  transition: color 0.16s;
}

.brand:hover {
  color: var(--accent);
}

.brand-lockup>span.current-section {
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: var(--line-height-compact);
}

.current-section {
  text-overflow: ellipsis;
  width: 5em;
  overflow: hidden;
}

.desktop-nav ul,
.mobile-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.desktop-nav ul {
  justify-content: flex-end;
  gap: 0.25rem;
  display: flex;
}

.desktop-nav li,
.mobile-nav li {
  min-width: 0;
}

.desktop-nav a,
.mobile-nav a {
  border-radius: var(--radius-ui);
  color: var(--text-secondary);
  font-size: var(--text-md);
  line-height: var(--line-height-compact);
  white-space: nowrap;
  flex: none;
  padding: 0.45rem 0.55rem;
  transition: background-color 0.16s, color 0.16s;
  position: relative;
  text-decoration: none;
}

.desktop-nav a:hover,
.mobile-nav a:hover {
  background: var(--background-elevated);
}

.desktop-nav a.active,
.mobile-nav a.active {
  color: var(--accent);
}

.nav-index {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  font-variant-numeric: tabular-nums;
  margin-right: 0.35rem;
}

.nav-label:after {
  content: "";
  opacity: 0;
  transform-origin: 50%;
  vertical-align: 0.18em;
  background: currentColor;
  border-radius: 50%;
  width: 0.28rem;
  height: 0.28rem;
  margin-left: 0.32rem;
  transition: opacity 0.16s, transform 0.16s;
  display: inline-block;
  transform: scale(0.45);
}

a.active .nav-label:after {
  opacity: 1;
  transform: scale(1);
}

.actions {
  align-items: center;
  gap: 0.2rem;
  display: flex;
}

.menu-toggle {
  border-radius: var(--radius-ui);
  width: 2.25rem;
  height: 2.25rem;
  color: var(--text-secondary);
  cursor: pointer;
  background: 0 0;
  border: 0;
  place-items: center;
  padding: 0;
  transition: background-color 0.16s, color 0.16s;
  display: none;
}

.menu-toggle:hover,
.menu-toggle[aria-expanded="true"] {
  background: var(--background-elevated);
  color: var(--accent);
}

.menu-toggle svg {
  width: var(--header-icon-size);
  height: var(--header-icon-size);
  fill: none;
  stroke: currentColor;
  stroke-width: var(--header-icon-stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.close-icon,
.mobile-nav,
.menu-toggle[aria-expanded="true"] .menu-icon {
  display: none;
}

.menu-toggle[aria-expanded="true"] .close-icon {
  display: block;
}

/* ---------- 主题切换 ---------- */
.theme-toggle {
  border-radius: var(--radius-ui);
  width: 2.25rem;
  height: 2.25rem;
  color: var(--text-secondary);
  cursor: pointer;
  background: 0 0;
  border: 0;
  place-items: center;
  padding: 0;
  transition: background-color 0.16s, color 0.16s;
  display: grid;
  position: relative;
}

.theme-toggle:hover {
  background: var(--background-elevated);
  color: var(--accent);
}

.theme-toggle svg {
  width: var(--header-icon-size);
  height: var(--header-icon-size);
  fill: none;
  stroke: currentColor;
  stroke-width: var(--header-icon-stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 0.16s, transform 0.16s;
  position: absolute;
}

.sun {
  opacity: 0;
  transform: rotate(-18deg) scale(0.75);
}

.moon,
.dark .sun {
  opacity: 1;
  transform: rotate(0) scale(1);
}

.dark .moon {
  opacity: 0;
  transform: rotate(18deg) scale(0.75);
}

/* ---------- 搜索按钮与对话框 ---------- */
.search-trigger,
.search-close {
  border-radius: var(--radius-ui);
  width: 2.25rem;
  height: 2.25rem;
  color: var(--text-secondary);
  cursor: pointer;
  background: 0 0;
  border: 0;
  place-items: center;
  padding: 0;
  transition: background-color 0.16s, color 0.16s;
  display: grid;
}

.search-trigger:hover,
.search-close:hover {
  background: var(--background-elevated);
  color: var(--accent);
}

.search-trigger svg,
.search-close svg,
.search-input-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-linejoin: round;
  width: 1.125rem;
  height: 1.125rem;
}

.search-dialog {
  --search-dialog-top: clamp(2rem, 10dvh, 6rem);
  --search-dialog-bottom: 1rem;
  --search-dialog-max-height: min(38rem, calc(100dvh - var(--search-dialog-top) - var(--search-dialog-bottom)));
  inset-block: var(--search-dialog-top) auto;
  width: min(38rem, 100% - 2rem);
  max-height: var(--search-dialog-max-height);
  border-radius: var(--radius-ui);
  background: var(--background-header);
  backdrop-filter: saturate(150%) blur(12px);
  color: var(--text-secondary);
  border: 0;
  margin-block: 0;
  margin-inline: auto;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 18px 60px #0003;
}

.search-dialog::backdrop {
  backdrop-filter: blur(2px);
  background: #0f121480;
}

.search-panel {
  max-height: var(--search-dialog-max-height);
  grid-template-rows: auto minmax(8rem, 1fr) auto;
  display: grid;
}

.search-head {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem;
  display: grid;
}

.search-input-icon {
  color: var(--text-muted);
}

.search-input {
  border-radius: var(--radius-ui);
  background: var(--background-body);
  width: 100%;
  min-width: 0;
  color: var(--text-primary);
  font-size: var(--text-md);
  border: 0;
  outline: 0;
  padding: 0.4rem 0.6rem;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input::-webkit-search-cancel-button {
  display: none;
}

.search-body {
  overscroll-behavior: contain;
  min-height: 8rem;
  overflow-y: auto;
}

.search-status {
  color: var(--text-muted);
  text-align: center;
  margin: 0;
  padding: 2.5rem 1rem;
}

.search-results {
  margin: 0;
  padding: 0.25rem 0.5rem 0.5rem;
  list-style: none;
}

.search-result-item {
  margin: 0;
}

.search-result-item+.search-result-item {
  border-top: 1px solid var(--border-weak);
}

.search-result-item a {
  border-radius: var(--radius-ui);
  color: inherit;
  gap: 0.15rem;
  padding: 0.55rem 0.6rem;
  display: grid;
  text-decoration: none;
  transition: background 0.14s, color 0.14s;
}

.search-result-item a:hover {
  background: var(--background-body);
  color: var(--accent);
}

.search-result-title {
  color: var(--text-primary);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-excerpt {
  color: var(--text-muted);
  font-size: var(--text-sm);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result-meta {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

/* ---------- 返回顶部 ---------- */
.back-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 90;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 999px;
  background: var(--background-elevated);
  color: var(--text-secondary);
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.1rem;
  box-shadow: 0 8px 24px #0001;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s, color 0.16s, background 0.16s;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.back-to-top:hover {
  color: var(--accent);
}

.back-to-top svg {
  width: 1rem;
  height: 1rem;
}

.back-to-top-text {
  font-size: 0.625rem;
  font-weight: var(--weight-medium);
}

/* ---------- 搜索帮助 ---------- */
.search-help {
  min-height: 2.5rem;
  color: var(--text-muted);
  font-size: var(--text-xs);
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  padding: 0.45rem 0.75rem;
  display: flex;
}

.search-help p {
  white-space: nowrap;
  flex: none;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  display: inline-flex;
}

kbd {
  background: var(--background-body);
  min-width: 1.35rem;
  color: var(--text-secondary);
  font-family: var(--font-family-mono);
  text-align: center;
  border: 0;
  border-radius: 3px;
  padding: 0.05rem 0.25rem;
  font-size: 0.68rem;
  line-height: 1.4;
}

/* ---------- 页头信息区 ---------- */
.page-header {
  margin-bottom: 1.25rem;
}

.page-header-title-line {
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  display: flex;
}

.page-header h1 {
  font-size: var(--text-3xl);
  letter-spacing: 0;
  margin: 0;
}

.page-header-meta {
  color: var(--text-muted);
  font-size: var(--text-xs);
  flex: none;
  margin: 0;
}

.content-section {
  min-width: 0;
}

.content-section.divided {
  padding-top: 1rem;
}

/* ---------- 站点简介 ---------- */
.site-intro {
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 1rem;
  padding-bottom: 1.25rem;
  display: grid;
}

.site-intro img {
  object-fit: cover;
  width: 72px;
  height: 72px;
}

.site-intro>div {
  align-content: center;
  row-gap: 0.15rem;
  min-width: 0;
  display: grid;
}

.site-intro h1 {
  font-size: var(--text-3xl);
  line-height: var(--line-height-tight);
  margin: 0;
}

.site-intro p {
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: var(--line-height-compact);
  margin: 0;
}

.site-intro .site-intro-bio {
  color: var(--text-secondary);
}

.site-intro-motto {
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  display: flex;
}

.site-intro a {
  font-size: var(--text-xs);
  white-space: nowrap;
  text-decoration: none;
}

.archive-link {
  font-size: var(--text-xs);
  text-decoration: none;
}

.archive-link:hover {
  color: var(--accent);
}

/* ---------- 文章发布热力图 ---------- */
main .post-heatmap-top-wrapper {
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin-bottom: 20px;
  border: none;
  box-shadow: none;
  box-sizing: border-box;
  width: 100%;
}

/* ---------- 文章流 ---------- */
.stream-section>header {
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
}

.stream-section>header>h2 {
  font-size: var(--text-lg);
  margin: 0;
}

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-list-item {
  padding: var(--list-row-gap) 0;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 1rem;
  display: grid;
}

.post-list-item:first-child {
  padding-top: 0;
}

.post-list-date {
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: var(--line-height-compact);
  padding-top: 0.15rem;
}

.post-list-body {
  min-width: 0;
}

.post-list-title {
  font-size: var(--text-md);
  line-height: var(--line-height-compact);
  margin: 0;
}

.post-list-title a {
  color: var(--text-primary);
  text-decoration: none;
}

.post-list-title a:hover {
  color: var(--accent);
}

.post-list-body>p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: var(--line-height-compact);
  margin: 0.3rem 0 0;
}

.post-list-meta {
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-top: 0.4rem;
  display: flex;
}

.post-list-reading-time {
  color: var(--text-muted);
  font-size: var(--text-xs);
  white-space: nowrap;
}

.post-list-tags {
  flex-wrap: wrap;
  gap: 0.25rem 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
}

.post-list-tags a {
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-decoration: none;
}

.post-list-tags a:hover {
  color: var(--accent);
}

.post-list-empty {
  color: var(--text-muted);
  padding: 1rem 0;
}

.log-topflg {
  color: var(--accent);
  font-size: var(--text-xs);
  margin-right: 0.4rem;
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0 0.25rem;
  vertical-align: 0.15em;
}

@media (max-width: 560px) {
  .post-list-item {
    display: block;
  }

  .post-list-date {
    padding: 0;
    display: block;
  }

  .post-list-body {
    margin-top: 0.2rem;
  }
}

/* ---------- 标签网格 ---------- */
.tag-grid {
  column-count: 3;
  column-gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag-grid li {
  break-inside: avoid;
}

.tag-grid a {
  break-inside: avoid;
  color: var(--text-primary);
  grid-template-columns: 2ch minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.45rem 0;
  text-decoration: none;
  display: grid;
}

.tag-grid a:hover {
  color: var(--accent);
}

.tag-grid .tag-index {
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: var(--line-height-compact);
  font-variant-numeric: tabular-nums;
  margin: 0;
}

.tag-grid strong {
  min-width: 0;
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  line-height: var(--line-height-compact);
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.tag-grid small {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

/* ---------- 归档 ---------- */
.collection-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.collection-list a {
  padding: 0 0 var(--list-row-gap);
  color: var(--text-primary);
  text-decoration: none;
  display: block;
}

.collection-list li+li a {
  padding-top: var(--list-row-gap);
}

.collection-list strong,
.collection-list small {
  display: block;
}

.collection-list strong {
  font-size: var(--text-md);
}

.collection-list-details {
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-top: 0.3rem;
  display: flex;
}

.collection-list small {
  min-width: 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: var(--line-height-compact);
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.collection-list .collection-count {
  color: var(--text-muted);
  white-space: nowrap;
  flex: none;
}

.years {
  gap: 1.4rem;
  display: grid;
}

.year-group {
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 1rem;
  display: grid;
}

.year-group>h2 {
  font-size: var(--text-lg);
  margin: 0;
}

.year-group>h2 small {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  display: block;
}

/* ---------- 友链 ---------- */
.friends-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  margin-bottom: 1.25rem;
}

.friends-list li {
  min-width: 0;
}

.friends-list a {
  color: var(--text-primary);
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0;
  text-decoration: none;
  display: grid;
}

.friends-list a:hover {
  color: var(--accent);
}

.friends-list img,
.friend-avatar {
  border-radius: var(--radius-ui);
  object-fit: cover;
  width: 40px;
  height: 40px;
}

.friend-avatar {
  background: var(--background-elevated);
  color: var(--text-muted);
  place-items: center;
  display: grid;
  font-size: var(--text-md);
}

.friends-list strong,
.friends-list small {
  display: block;
}

.friends-list strong {
  font-size: var(--text-md);
}

.friends-list small {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: var(--line-height-compact);
  margin-top: 0.3rem;
}

/* ---------- 正文内容 ---------- */
.content-prose h1 {
  font-size: var(--text-2xl);
  margin: 2rem 0 0.75rem;
}

.content-prose h2 {
  font-size: var(--text-xl);
  margin: 1.8rem 0 0.65rem;
}

.content-prose h3 {
  font-size: var(--text-lg);
  margin: 1.5rem 0 0.55rem;
}

.content-prose h4 {
  font-size: var(--text-md);
  margin: 1.25rem 0 0.45rem;
}

.content-prose h5,
.content-prose h6 {
  font-size: var(--text-sm);
  margin: 1.25rem 0 0.45rem;
}

.content-prose p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin: 0 0 1rem;
}

.content-prose ul,
.content-prose ol {
  margin: 0.5rem 0 1rem;
  padding-left: 1.35rem;
}

.content-prose li+li {
  margin-top: 0.25rem;
}

.content-prose table {
  margin: 1rem 0;
  display: block;
  width: 100%;
  overflow: auto;
  word-break: normal;
  word-break: keep-all;
  border-collapse: collapse;
}

.content-prose :where(img, video, iframe, svg, canvas) {
  max-width: 100%;
}

.content-prose img {
  cursor: zoom-in;
}

/* ---------- 代码块与复制按钮 ---------- */
.code-block {
  margin: 1rem 0;
  position: relative;
}

.code-block pre {
  background: var(--background-elevated) !important;
  margin: 0;
  padding-right: 4.5rem;
}

.code-copy-button {
  border-radius: var(--radius-ui);
  background: var(--background-body);
  color: var(--text-muted);
  font-family: var(--font-family-text);
  font-size: var(--text-xs);
  line-height: var(--line-height-compact);
  cursor: pointer;
  border: 0;
  padding: 0.25rem 0.45rem;
  transition: background-color 0.16s, color 0.16s;
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

.code-copy-button:hover,
.code-copy-button[data-state="success"] {
  color: var(--accent);
}

.code-copy-button[data-state="error"] {
  color: var(--text-secondary);
}

/* ---------- 面包屑 ---------- */
.breadcrumb {
  color: var(--text-muted);
  font-size: var(--text-xs);
  margin-bottom: .55rem;
}

.breadcrumb ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
}

.breadcrumb li+li:before {
  content: "/";
  margin: 0 .4rem;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none
}

/* ---------- 文章详情 ---------- */
.single {
  max-width: var(--reading-max-width);
  margin: 0 auto;
}

.reading-column {
  width: var(--reading-max-width);
  max-width: 100%;
}

.page-header {
  margin-bottom: 1.25rem;
}

.page-header-title-line,
.page-header-description-line {
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  display: flex
}

.page-header h1 {
  font-size: var(--text-3xl);
  letter-spacing: 0;
  margin: 0
}

.page-header-meta {
  color: var(--text-muted);
  font-size: var(--text-xs);
  flex: none;
  margin: 0
}

.page-header-description-line {
  margin-top: .35rem
}

.page-header-description-line p {
  min-width: 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin: 0
}

.page-header-description-line p.is-italic {
  font-style: italic
}

.page-header-description-line .archive-link {
  flex: none
}

.log-header {
  margin-bottom: 1.25rem;
}

.log-title {
  font-size: var(--text-3xl);
  margin: 0 0 0.5rem;
}

.log-meta,
.log-tags {
  color: var(--text-muted);
  font-size: var(--text-xs);
  flex-wrap: wrap;
  gap: .35rem .8rem;
  margin: .55rem 0 0;
  padding: 0;
  display: flex;
}

.log-meta>div {
  gap: .25rem;
  display: flex;
}

.log-meta dt,
.log-meta dd {
  margin: 0;
}

.log-meta a {
  color: var(--text-muted);
  text-decoration: none;
}

.log-meta a:hover {
  color: var(--accent);
}

.log-tags {
  margin-top: .35rem;
  list-style: none
}

.log-tags a {
  color: var(--accent);
  text-decoration: none
}

.content-tags {
  margin: 1.25rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gray-light);
}

/* ---------- 相邻文章 ---------- */
.neighbor-log {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-light);
  display: grid;
}

.neighbor-link {
  color: var(--text-primary);
  text-decoration: none;
  display: grid;
  gap: 0.15rem;
}

.neighbor-link.next-log {
  text-align: right;
}

.neighbor-link:hover {
  color: var(--accent);
}

.neighbor-dir {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.neighbor-title {
  font-size: var(--text-md);
  line-height: var(--line-height-compact);
}

/* ---------- 评论区 ---------- */
.comments-section {
  margin-top: 2rem;
}

.comment-header h3 {
  font-size: var(--text-lg);
  margin: 0 0 0.5rem;
}

.comment {
  padding: 0.9rem 0;
  display: flex;
  gap: 0.75rem;
}

.comment+.comment {
  border-top: 1px solid var(--gray-light);
}

.comment-children {
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 1px solid var(--gray-light);
}

.comment-children .comment+.comment {
  border-top: 0;
}

.comment-avatar img {
  border-radius: var(--radius-ui);
  width: 40px;
  height: 40px;
  object-fit: cover;
}

.comment-body {
  min-width: 0;
  flex: 1;
}

.comment-meta {
  align-items: center;
  gap: 0.6rem;
  display: flex;
}

.comment-name {
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.comment-name a {
  color: var(--text-primary);
  text-decoration: none;
}

.comment-name a:hover {
  color: var(--accent);
}

.comment-time {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.comment-content {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin: 0.25rem 0 0.35rem;
  overflow-wrap: break-word;
}

.comment-content p {
  margin: 0.25rem 0;
}

.comment-reply {
  margin-left: auto;
  text-align: right;
}

.com-reply {
  background: 0 0;
  border: 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
  cursor: pointer;
  padding: 0;
}

.com-reply:hover {
  color: var(--accent);
}

/* ---------- 评论表单 ---------- */
.comment-post {
  margin-top: 2rem;
}

.comment-post-title h3 {
  font-size: var(--text-lg);
  margin: 0 0 0.75rem;
}

.commentform {
  background: var(--background-elevated);
  border-radius: var(--radius-ui);
  padding: 1rem;
  display: grid;
  gap: 0.6rem;
}

.comment-textarea {
  width: 100%;
  min-height: 7rem;
  border-radius: var(--radius-ui);
  border: 0;
  background: var(--background-body);
  color: var(--text-primary);
  font-family: var(--font-family-text);
  font-size: var(--text-sm);
  line-height: var(--line-height-compact);
  resize: vertical;
  padding: 0.6rem;
}

.comment-textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

.comment-info {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.6rem;
  display: grid;
}

.comment-field {
  width: 100%;
  border-radius: var(--radius-ui);
  border: 0;
  background: var(--background-body);
  color: var(--text-primary);
  font-size: var(--text-sm);
  padding: 0.45rem 0.6rem;
}

.comment-field:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

.captcha-container {
  grid-column: 1 / -1;
  align-items: center;
  gap: 0.6rem;
  display: flex;
}

.captcha-container .captcha {
  border-radius: var(--radius-ui);
  cursor: pointer;
  height: 2.1rem;
  border: 1px solid var(--gray-light);
}

.captcha-container .captcha_input {
  width: 7rem;
  border-radius: var(--radius-ui);
  border: 0;
  background: var(--background-body);
  color: var(--text-primary);
  font-size: var(--text-sm);
  padding: 0.45rem 0.6rem;
}

.captcha-switch {
  background: 0 0;
  border: 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
  cursor: pointer;
  padding: 0.2rem 0.3rem;
}

.captcha-switch:hover {
  color: var(--accent);
}

.comment-submit {
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  display: flex;
  flex-wrap: wrap;
}

.comment-actions {
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
  display: flex;
}

.replying-to {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-left: 2px solid var(--accent);
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: 0.3rem 0.6rem;
}

.comment-textarea.is-replying {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

.comment-mention {
  color: var(--accent);
  font-weight: var(--weight-medium);
}

.login-tip {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.btn {
  border-radius: var(--radius-ui);
  background: var(--accent);
  color: #fff;
  border: 0;
  cursor: pointer;
  font-size: var(--text-sm);
  padding: 0.45rem 1.2rem;
  transition: opacity 0.16s;
}

.btn:hover {
  opacity: 0.85;
}

.cancel-reply {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(var(--gray-light), 1);
  cursor: pointer;
}

.cancel-reply:hover {
  color: var(--accent);
}

.edit-link,
.sort-link,
.author-link {
  color: var(--text-muted) !important;
}

/* ---------- 分页 ---------- */
.pagination,
.comment-page {
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
}

.comment-page {
  margin-top: 1rem;
}

.pagination span,
.pagination a,
.comment-page span,
.comment-page a {
  border-radius: var(--radius-ui);
  min-width: 2rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  text-decoration: none;
  padding: 0.3rem 0.55rem;
  display: inline-block;
}

.pagination a:hover,
.comment-page a:hover {
  background: var(--background-elevated);
  color: var(--accent);
}

.pagination .current,
.comment-page .current {
  background: var(--accent);
  color: #fff;
}

/* ---------- 页脚 ---------- */
.site-footer {
  width: var(--page-max-width);
  max-width: calc(100% - 2rem);
  margin: 0 auto;
}

.footer-inner {
  min-height: 3.5rem;
  color: var(--text-muted);
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  display: flex;
}

.footer-inner p {
  font-size: var(--text-xs);
  margin: 0;
}

.footer-inner a {
  color: var(--text-muted);
}

/* ---------- 404 ---------- */
body.is-404 {
  align-items: center;
  justify-content: center;
}

body.is-404 main {
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-card {
  text-align: center;
  padding: 2rem;
}

.error-code {
  font-size: clamp(3rem, 10vw, 5.5rem);
  font-weight: 800;
  margin: 0;
  line-height: 1;
  color: var(--accent);
  opacity: 0.35;
  letter-spacing: -1px;
}

.error-msg {
  color: var(--text-muted);
  margin: 0.75rem 0 1.5rem;
}

.error-home {
  display: inline-block;
  background: var(--accent);
  color: #fff !important;
  border-radius: var(--radius-ui);
  padding: 0.55rem 1.6rem;
  text-decoration: none;
  font-size: var(--text-sm);
}

/* ---------- 密码页 ---------- */
body.is-pw {
  align-items: center;
  justify-content: center;
}

body.is-pw main {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pw-card {
  background: var(--background-elevated);
  border-radius: var(--radius-ui);
  width: 100%;
  max-width: 26rem;
  padding: 1.75rem 1.5rem 1.5rem;
}

.pw-title {
  font-size: var(--text-xl);
  margin: 0 0 1.25rem;
  text-align: center;
}

.pw-form {
  display: flex;
  gap: 0.5rem;
}

.pw-input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(var(--gray-light), 1);
  border-radius: var(--radius-ui);
  background: var(--background-body);
  color: var(--text-primary);
  font-size: var(--text-md);
  padding: 0.45rem 0.75rem;
}

.pw-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

.pw-btn {
  flex: none;
}

.pw-back {
  color: var(--text-muted);
  display: block;
  font-size: var(--text-sm);
  margin-top: 1.25rem;
  text-align: center;
  text-decoration: none;
}

.pw-back:hover {
  color: var(--accent);
}

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .header-inner {
    grid-template-rows: 3.5rem;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0 0.5rem;
    max-width: calc(100% - 1.5rem);
    min-height: 0;
  }

  .desktop-nav {
    display: none;
  }

  .menu-toggle {
    display: grid;
  }

  .mobile-nav {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    grid-area: 2/1 / auto/-1;
    max-height: 0;
    padding: 0;
    transition: max-height 0.16s, opacity 0.16s, transform 0.16s, visibility 0s linear 0.16s;
    display: block;
    overflow: hidden;
    transform: translateY(-4px);
  }

  .mobile-nav ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.25rem;
    display: grid;
  }

  .mobile-nav.is-open {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    max-height: 8rem;
    padding: 0.2rem 0 0.7rem;
    transition-delay: 0s;
    transform: translateY(0);
  }

  .mobile-nav a {
    text-align: left;
    width: 100%;
    display: block;
  }
}

@media (max-width: 720px) {
  main {
    max-width: calc(100% - 1.5rem);
    padding: 1.25rem 0 2.5rem;
  }

  .year-group {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
}

@media (max-width: 560px) {
  .friends-list {
    grid-template-columns: 1fr;
  }

  .tag-grid {
    column-count: 2;
  }

  .site-footer {
    max-width: calc(100% - 1.5rem);
  }

  .footer-inner {
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 0;
  }

  .search-dialog {
    --search-dialog-top: 0.5rem;
    --search-dialog-bottom: 0.5rem;
    width: calc(100% - 1rem);
  }

  .search-help {
    justify-content: center;
    gap: 0.65rem;
  }

  .neighbor-log {
    grid-template-columns: 1fr;
  }

  .neighbor-link.next-log {
    text-align: left;
  }
}

@media (max-width: 360px) {
  .tag-grid {
    column-count: 1;
  }
}