:root {
  --primary: #165dff;
  --primary-hover: #2b6cff;
  --primary-soft: rgba(22, 93, 255, 0.07);
  --primary-subtle: rgba(22, 93, 255, 0.04);
  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-subtle: #f7f8fa;
  --line: #e5e7ec;
  --line-strong: #d0d4dc;
  --text: #0d1117;
  --text-soft: #4b5563;
  --muted: #8b95a5;
  --success: #00b42a;
  --warning: #ff7d00;
  --danger: #f53f3f;
  --radius-xl: 16px;
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --shadow-xs: 0 1px 2px rgba(13, 17, 23, 0.04);
  --shadow-sm: 0 1px 3px rgba(13, 17, 23, 0.06), 0 1px 2px rgba(13, 17, 23, 0.04);
  --shadow: 0 4px 12px rgba(13, 17, 23, 0.06), 0 2px 4px rgba(13, 17, 23, 0.04);
  --shadow-lg: 0 12px 32px rgba(13, 17, 23, 0.08), 0 4px 8px rgba(13, 17, 23, 0.04);
  --shell: min(1180px, calc(100vw - 32px));
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
    sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", Consolas, Menlo, monospace;
  --font-serif: "PingFang SC", "Noto Serif CJK SC", "Source Han Serif SC",
    Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

button,
input,
textarea {
  font: inherit;
}

.page-gradient {
  display: none;
}

.shell {
  width: var(--shell);
  margin: 0 auto;
  position: relative;
}

/* ======================== header ======================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}

.header-shell {
  display: grid;
  grid-template-columns: auto 1fr minmax(220px, 300px);
  gap: 24px;
  align-items: center;
  padding: 10px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: opacity 160ms ease;
}

.brand:hover {
  opacity: 0.85;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(22, 93, 255, 0.25);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-copy strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.brand-copy small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.top-nav {
  display: inline-flex;
  gap: 2px;
  justify-self: center;
}

.top-nav a {
  padding: 6px 14px;
  border-radius: var(--radius-md);
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 500;
  transition: background 180ms ease, color 180ms ease;
}

.top-nav a:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.header-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.header-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(242, 244, 248, 0.7);
  padding: 7px 12px;
  font-size: 13px;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.header-search input:focus {
  outline: 0;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.12);
}

.header-search button {
  border: 0;
  border-radius: var(--radius-md);
  padding: 7px 16px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 180ms ease, transform 120ms ease;
}

.header-search button:hover {
  background: var(--primary-hover);
}

.header-search button:active {
  transform: scale(0.97);
}

/* ======================== buttons ======================== */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 120ms ease, box-shadow 180ms ease;
}

.button:active {
  transform: scale(0.97);
}

.button.primary {
  background: linear-gradient(135deg, var(--primary), #3b78ff);
  color: #fff;
  box-shadow: 0 2px 8px rgba(22, 93, 255, 0.25);
}

.button.primary:hover {
  background: linear-gradient(135deg, var(--primary-hover), #4f8bff);
  color: #fff;
  box-shadow: 0 4px 14px rgba(22, 93, 255, 0.32);
}

.button.ghost {
  background: var(--surface);
  color: var(--text-soft);
  border-color: var(--line);
}

.button.ghost:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-subtle);
}

/* ======================== layout ======================== */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 24px;
  padding: 28px 0 64px;
}

.hero-panel,
.featured-panel,
.content-panel,
.sidebar-card,
.article-panel,
.article-sidebar,
.page-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: box-shadow 200ms ease, border-color 200ms ease;
}

.hero-panel {
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, var(--surface) 0%, #fafbff 60%, var(--primary-subtle) 100%);
  grid-column: 1 / -1;
}

.hero-panel::before {
  content: "";
  position: absolute;
  top: -60%;
  right: -20%;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(22, 93, 255, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero-kicker,
.section-heading span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero-panel h1,
.page-hero h1,
.article-panel h1 {
  margin: 4px 0 8px;
  font-size: clamp(1.7rem, 3.2vw, 2.4rem);
  line-height: 1.2;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.hero-panel p,
.page-hero p,
.article-summary,
.featured-panel p {
  margin: 0;
  max-width: 44rem;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.75;
}

.hero-actions,
.article-actions,
.featured-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.featured-panel,
.content-panel {
  grid-column: 1 / 2;
}

.featured-panel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--surface) 0%, var(--primary-subtle) 100%);
}

.featured-panel::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(22, 93, 255, 0.07) 0%, transparent 70%);
  pointer-events: none;
}

.sidebar-panel {
  display: grid;
  gap: 16px;
}

.sidebar-toggle {
  display: none;
}

.sidebar-content {
  display: grid;
  gap: 16px;
}

.sidebar-card {
  padding: 20px;
}

.section-heading {
  margin-bottom: 16px;
}

.section-actions {
  display: flex;
  justify-content: flex-start;
  margin: 0 0 16px;
}

.section-heading h2,
.section-heading h3 {
  margin: 6px 0 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.section-heading.compact {
  margin-bottom: 12px;
}

/* ======================== post cards ======================== */
.post-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.archive-panel {
  display: grid;
  gap: 16px;
}

.archive-feed-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.archive-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

.archive-complete,
.archive-noscript {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.archive-sentinel {
  width: 100%;
  height: 1px;
}

.post-card,
.search-item {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: grid;
  gap: 10px;
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.post-card:hover,
.search-item:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.post-card h3,
.search-item h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  letter-spacing: -0.01em;
}

.post-card h3 a:hover,
.search-item h3 a:hover {
  color: var(--primary);
}

.post-card p,
.search-item p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-top,
.post-card-bottom,
.meta-row,
.article-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: space-between;
  font-size: 12px;
}

.stat,
.meta-row,
.muted,
.search-count {
  color: var(--muted);
}

.pill,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--line);
  line-height: 1.5;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 120ms ease;
}

.pill {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: transparent;
}

.tag {
  background: var(--surface-subtle);
  color: var(--text-soft);
}

.tag:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-subtle);
  transform: translateY(-1px);
}

.cluster,
.tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.recommend-list {
  display: grid;
  gap: 8px;
}

.recommend-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid transparent;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.recommend-item:hover {
  background: var(--primary-soft);
  border-color: rgba(22, 93, 255, 0.15);
  transform: translateX(2px);
}

.recommend-item strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.recommend-item small {
  font-size: 12px;
  color: var(--muted);
}

/* ======================== list / search ======================== */
.list-shell,
.post-shell {
  padding: 24px 0 56px;
}

.content-with-sidebar,
.post-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) 300px;
  gap: 20px;
  align-items: start;
}

.compact-hero {
  margin-bottom: 20px;
}

.page-hero.compact-hero {
  background: linear-gradient(160deg, var(--surface) 0%, #fafbff 60%, var(--primary-subtle) 100%);
  position: relative;
  overflow: hidden;
}

.page-hero.compact-hero::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(22, 93, 255, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  max-width: 680px;
  margin-top: 16px;
}

.search-panel input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  padding: 10px 14px;
  font-size: 14px;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.search-panel input[type="search"]:focus {
  outline: 0;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.12);
}

.search-mode-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
}

.search-mode-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}

.search-mode-option input {
  display: none;
}

.search-mode-option:has(input:checked) {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
  font-weight: 600;
}

.search-mode-option:hover:not(:has(input:checked)) {
  color: var(--text);
}

.search-panel .button.primary {
  padding: 10px 22px;
}

.search-meta-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 13px;
}

.search-meta-bar .search-count {
  color: var(--text-soft);
  font-weight: 500;
}

.search-meta-bar .search-count strong {
  color: var(--text);
  font-weight: 700;
}

.search-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.search-notice-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(22, 93, 255, 0.07);
  border: 1px solid rgba(22, 93, 255, 0.12);
  color: var(--primary);
  font-size: 12px;
  font-weight: 500;
}

.search-list {
  display: grid;
  gap: 12px;
}

.search-item {
  padding: 20px;
}

.search-item h3 {
  font-size: 16px;
}

.search-item .snippet {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.7;
}

.search-item .snippet mark {
  background: rgba(22, 93, 255, 0.12);
  color: var(--primary);
  border-radius: 3px;
  padding: 0 3px;
  font-weight: 600;
}

.search-submit-status {
  margin-top: 12px !important;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.6;
}

.search-notice {
  margin-top: 14px !important;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(22, 93, 255, 0.14);
  background: rgba(22, 93, 255, 0.06);
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 56px 24px;
  text-align: center;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 24px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.button.is-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.92;
}

.button.is-loading::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border-radius: 999px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  vertical-align: -2px;
  animation: button-spin 0.8s linear infinite;
}

/* ======================== article ======================== */
.article-panel {
  min-width: 0;
  overflow: hidden;
}

.article-panel h1 {
  font-size: clamp(1.9rem, 3.2vw, 2.6rem);
}

.article-summary {
  max-width: 780px;
}

.article-content {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
  min-width: 0;
}

.article-end-actions {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px dashed var(--line);
}

.article-actions-bottom {
  margin-top: 12px;
}

.prose {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
  overflow-wrap: break-word;
  word-break: break-word;
}

.prose > * + * {
  margin-top: 1em;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  margin-top: 1.8em;
  margin-bottom: 0.5em;
  font-weight: 700;
  line-height: 1.3;
  scroll-margin-top: 80px;
  color: var(--text);
}

.prose h2 {
  font-size: 1.45rem;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--line);
}

.prose h3 {
  font-size: 1.2rem;
}

.prose h4 {
  font-size: 1.05rem;
}

.prose p,
.prose li {
  color: var(--text);
}

.prose a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.prose pre {
  overflow: auto;
  margin: 0;
  padding: 14px 16px 16px;
  border-radius: var(--radius-md);
  background: #fcfdff !important;
  font-size: 13px;
  line-height: 1.6;
}

.prose .code-block {
  margin: 18px 0;
  border: 1px solid #dbe3f0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #fcfdff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  max-width: 100%;
}

.prose .code-block pre {
  border-radius: 0;
}

.prose .code-block-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: linear-gradient(180deg, #f6f9ff 0%, #eef4ff 100%);
  border-bottom: 1px solid #dbe3f0;
}

.prose .code-block-language {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #344054;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.prose .code-block-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(22, 93, 255, 0.12);
  color: #165dff;
  font-size: 13px;
  font-weight: 700;
  font-family:
    "Symbols Nerd Font Mono",
    "Symbols Nerd Font",
    "JetBrainsMono Nerd Font",
    "FiraCode Nerd Font",
    var(--font-mono);
}

.prose .code-block-language-text {
  line-height: 1;
}

.prose .code-copy-button {
  border: 1px solid #c8d6ea;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #475467;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.4;
}

.prose .code-copy-button:hover,
.prose .code-copy-button:focus-visible {
  background: rgba(22, 93, 255, 0.1);
  color: #165dff;
}

.prose code {
  font-family: var(--font-mono);
}

.prose pre code,
.prose pre code span {
  color: #1f2937;
  background: transparent !important;
}

.prose .chroma,
.prose .chroma-chroma {
  color: #1f2937;
}

.prose .chroma-c,
.prose .chroma-c1,
.prose .chroma-cm,
.prose .chroma-cp,
.prose .chroma-cpf,
.prose .chroma-cs,
.prose .chroma-ch {
  color: #6b7280;
  font-style: italic;
}

.prose .chroma-k,
.prose .chroma-kc,
.prose .chroma-kd,
.prose .chroma-kn,
.prose .chroma-kp,
.prose .chroma-kr,
.prose .chroma-kt,
.prose .chroma-o,
.prose .chroma-ow {
  color: #cf222e;
}

.prose .chroma-nf,
.prose .chroma-fm,
.prose .chroma-nc,
.prose .chroma-nd,
.prose .chroma-ne {
  color: #8250df;
}

.prose .chroma-s,
.prose .chroma-s1,
.prose .chroma-s2,
.prose .chroma-sa,
.prose .chroma-sb,
.prose .chroma-sc,
.prose .chroma-sd,
.prose .chroma-se,
.prose .chroma-sh,
.prose .chroma-si,
.prose .chroma-sr,
.prose .chroma-ss,
.prose .chroma-dl {
  color: #0a7ea4;
}

.prose .chroma-m,
.prose .chroma-mb,
.prose .chroma-mf,
.prose .chroma-mh,
.prose .chroma-mi,
.prose .chroma-il,
.prose .chroma-mo,
.prose .chroma-nb,
.prose .chroma-bp {
  color: #0550ae;
}

.prose .chroma-na,
.prose .chroma-nt {
  color: #116329;
}

.prose .chroma-vc,
.prose .chroma-vg,
.prose .chroma-vi,
.prose .chroma-vm {
  color: #953800;
}

.prose .chroma-err {
  color: #cf222e;
  background: rgba(207, 34, 46, 0.08) !important;
}

.prose :where(p, li, td, th, blockquote) code {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.88em;
  font-weight: 500;
}

.prose s,
.prose del {
  color: var(--text-soft);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  text-decoration-color: currentColor;
}

.prose blockquote {
  margin: 1em 0;
  padding: 2px 14px;
  border-left: 3px solid var(--primary);
  background: var(--surface-subtle);
  color: var(--text-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.prose table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 13px;
  table-layout: auto;
}

.prose th {
  background: var(--surface-subtle);
  font-weight: 600;
}

.prose th,
.prose td {
  padding: 8px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.prose tr > :last-child {
  border-right: 0;
}

.prose th[align="center"],
.prose td[align="center"] {
  text-align: center;
}

.prose th[align="right"],
.prose td[align="right"] {
  text-align: right;
}

.prose li input[type="checkbox"] {
  margin-right: 8px;
  accent-color: var(--primary);
  vertical-align: text-bottom;
}

.prose tr:last-child td {
  border-bottom: 0;
}

.prose img {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  max-width: 100%;
  height: auto;
}

.article-sidebar {
  position: sticky;
  top: 72px;
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 88px);
  overflow-y: auto;
}

.toc-fab,
.toc-close {
  display: none;
}

.toc-fab[hidden] {
  display: none;
}

.toc-list {
  display: grid;
  gap: 4px;
}

.toc-list a {
  display: block;
  color: var(--text-soft);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
  transition: color 160ms ease, font-weight 160ms ease;
}

.toc-list a:hover,
.toc-list a:focus-visible {
  color: var(--primary);
  font-weight: 600;
}

.toc-list a.is-active {
  color: var(--primary);
  font-weight: 600;
}

.toc-preview {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
}

.toc-preview strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 12px;
}

.toc-preview p {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.6;
}

/* ======================== comment ======================== */
.comment-panel {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.comment-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.empty-text,
.widget-badge {
  color: var(--muted);
  font-size: 13px;
}

/* ======================== footer ======================== */
.site-footer {
  padding: 0 0 32px;
  margin-top: 40px;
}

.footer-shell {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-soft);
}

.footer-shell strong {
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.footer-shell p {
  margin: 6px 0 0;
  max-width: 560px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.footer-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  text-align: right;
  font-size: 12px;
  font-weight: 500;
}

/* ======================== about ======================== */
.about-shell {
  display: grid;
  gap: 22px;
  max-width: 900px;
  padding: 28px 0 64px;
}

.about-hero,
.about-card,
.about-links {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.about-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  padding: 24px;
}

.about-avatar-wrap {
  width: 108px;
  height: 108px;
  border-radius: 999px;
  padding: 6px;
  background: linear-gradient(135deg, rgba(22, 93, 255, 0.12), rgba(22, 93, 255, 0.03));
}

.about-avatar-image,
.about-avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 999px;
}

.about-avatar-image {
  display: block;
  object-fit: cover;
}

.about-avatar-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #165dff, #5b7cfa);
  color: #fff;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.about-hero-copy {
  display: grid;
  gap: 10px;
}

.about-hero-copy h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.about-tagline {
  margin: 0;
  color: var(--text-soft);
  font-size: 16px;
  line-height: 1.7;
}

.about-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 18px;
}

.about-card {
  padding: 22px;
}

.about-card-head {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
}

.about-card-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.about-card-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.about-bio {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.85;
  white-space: pre-line;
}

.about-open-source-card {
  display: grid;
  gap: 16px;
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 12px;
}

.about-stat {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-subtle);
}

.about-stat strong {
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.about-stat span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.about-inline-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
}

.about-inline-link:hover {
  opacity: 0.85;
}

.about-links {
  padding: 22px;
}

.about-friend-grid {
  display: grid;
  gap: 12px;
}

.about-friend-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-subtle);
  transition: border-color 180ms ease, transform 120ms ease, box-shadow 180ms ease;
}

.about-friend-card:hover {
  border-color: rgba(22, 93, 255, 0.26);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.about-friend-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex-shrink: 0;
}

.about-friend-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.about-friend-copy strong {
  font-size: 14px;
  line-height: 1.3;
}

.about-friend-copy span {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
}

.about-friend-card small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

:focus-visible {
  outline: 2px solid rgba(22, 93, 255, 0.4);
  outline-offset: 2px;
}

/* ======================== responsive ======================== */
@media (max-width: 1120px) {
  .header-shell,
  .home-grid,
  .content-with-sidebar,
  .post-shell,
  .about-grid,
  .about-hero {
    grid-template-columns: 1fr;
  }

  .home-grid {
    gap: 20px;
    padding: 20px 0 48px;
  }

  .article-sidebar {
    position: static;
    max-height: none;
  }

  .toc-preview {
    display: none;
  }

  .post-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .archive-feed-summary {
    align-items: flex-start;
  }

  .search-panel {
    grid-template-columns: 1fr auto;
  }

  .search-mode-switch {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 760px) {
  :root {
    --shell: min(100vw - 20px, 100vw);
  }

  .site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--line);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    padding: 8px 0;
  }

  .header-shell {
    gap: 8px;
    grid-template-columns: 1fr auto;
    padding: 0;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .brand-copy strong {
    font-size: 13px;
  }

  .brand-copy small {
    display: none;
  }

  .header-search {
    grid-column: 1 / -1;
    display: none;
  }

  .top-nav {
    justify-self: end;
    flex-wrap: wrap;
    gap: 0;
  }

  .top-nav a {
    padding: 4px 8px;
    font-size: 12px;
  }

  .home-grid {
    gap: 16px;
    padding: 16px 0 40px;
  }

  .hero-panel {
    min-height: 180px;
    padding: 20px;
  }

  .hero-panel h1 {
    font-size: 1.6rem;
  }

  .hero-panel p {
    font-size: 14px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .button {
    justify-content: center;
  }

  .featured-panel,
  .content-panel,
  .sidebar-card,
  .article-panel,
  .article-sidebar,
  .page-hero,
  .about-hero,
  .about-card,
  .about-links {
    padding: 16px;
  }

  .post-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .section-heading h2 {
    font-size: 16px;
  }

  .about-avatar-wrap {
    width: 80px;
    height: 80px;
  }

  .footer-shell {
    flex-direction: column;
    padding: 16px;
  }

  .footer-meta {
    text-align: left;
  }

  .search-panel {
    grid-template-columns: 1fr;
  }

  .search-mode-switch {
    grid-column: auto;
    justify-self: stretch;
  }

  .prose table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  /* 可折叠侧边栏 */
  .sidebar-panel {
    position: relative;
  }

  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    transition: background 180ms ease, border-color 180ms ease;
  }

  .sidebar-toggle:hover {
    background: var(--surface-subtle);
    border-color: var(--line-strong);
  }

  .sidebar-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    transition: transform 200ms ease;
  }

  .sidebar-toggle-icon svg {
    width: 16px;
    height: 16px;
  }

  .sidebar-toggle[aria-expanded="true"] .sidebar-toggle-icon {
    transform: rotate(180deg);
  }

  .sidebar-content {
    display: none;
    margin-top: 12px;
    animation: sidebar-slide-down 200ms ease;
  }

  .sidebar-content.is-open {
    display: block;
  }

  @keyframes sidebar-slide-down {
    from {
      opacity: 0;
      transform: translateY(-8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .sidebar-content .sidebar-card {
    margin-bottom: 12px;
  }

  .sidebar-content .sidebar-card:last-child {
    margin-bottom: 0;
  }

  /* 文章目录悬浮按钮 */
  .article-sidebar {
    position: fixed;
    top: calc(64px + env(safe-area-inset-top));
    left: 12px;
    z-index: 40;
    width: min(320px, calc(100vw - 24px));
    max-height: min(72vh, calc(100vh - 92px));
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0;
    display: none;
  }

  .article-sidebar.is-open {
    display: block;
    animation: sidebar-slide-down 200ms ease;
  }

  .toc-fab {
    position: fixed;
    top: calc(64px + env(safe-area-inset-top));
    left: 12px;
    z-index: 50;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(22, 93, 255, 0.35);
    transition: transform 180ms ease, box-shadow 180ms ease;
  }

  .toc-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(22, 93, 255, 0.45);
  }

  .toc-fab:active {
    transform: scale(0.95);
  }

  .toc-fab svg {
    width: 20px;
    height: 20px;
  }

  .toc-fab.is-active {
    display: none;
  }

  .toc-close {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-subtle);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .toc-close span {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
  }

  .toc-close-btn {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text-soft);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 180ms ease, border-color 180ms ease;
  }

  .toc-close-btn:hover {
    background: var(--surface-subtle);
    border-color: var(--line-strong);
  }

  .toc-close-btn svg {
    width: 16px;
    height: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
}

@keyframes button-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
