:root {
  --bg: #fffdf8;
  --ink: #1c1917;
  --muted: #57534e;
  --line: #e7e5e4;
  --accent: #be123c;
  --accent-ink: #fff;
  --panel: #fffaf2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --font-sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans", Arial, sans-serif;
  --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", "Songti SC", STSong, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.7 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
  border: 0;
}

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

a:hover {
  text-decoration: underline;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-inline: 20px;
}

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 253, 248, .98);
  border-bottom: 1px solid var(--line);
}

.masthead .bar {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 10px 20px;
  align-items: center;
  min-height: 68px;
  padding-block: 10px;
}

.brand {
  min-width: 0;
  max-width: 34vw;
  color: var(--ink);
  font: 700 22px/1.15 var(--font-serif);
  overflow-wrap: anywhere;
}

.brand:hover {
  text-decoration: none;
}

.nav-aux {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px 12px;
}

.nav-cats {
  grid-column: 1 / -1;
  display: flex;
  min-width: 0;
  max-width: 100%;
  gap: 16px;
  overflow-x: auto;
  align-items: center;
  scrollbar-width: thin;
  padding: 2px 0 4px;
  overscroll-behavior-inline: contain;
}

.nav-cats a {
  flex: 0 0 auto;
  color: var(--muted);
  white-space: nowrap;
  padding: 5px 0;
  font-size: 15px;
}

.nav-cats a.current {
  color: var(--accent);
  font-weight: 700;
}

.searchbox {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
}

.searchbox input {
  width: clamp(110px, 15vw, 180px);
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font: 14px var(--font-sans);
}

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

.lang-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
  font-size: 13px;
}

.lang-switch a {
  color: var(--muted);
  white-space: nowrap;
}

.lang-switch a.on {
  color: var(--ink);
  font-weight: 700;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}

.btn:hover {
  text-decoration: none;
}

.btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-outline {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 36px;
  padding-block: 28px 40px;
}

.content,
.sidebar {
  min-width: 0;
}

.site-hero {
  margin: 10px 0 22px;
  padding-inline: 2px;
}

.site-hero h1 {
  margin: 0 0 10px;
  color: var(--ink);
  font: 800 38px/1.2 var(--font-serif);
  letter-spacing: .2px;
  overflow-wrap: anywhere;
}

.site-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

.list-title {
  margin: 4px 0 14px;
  color: var(--ink);
  font: 800 26px/1.2 var(--font-serif);
  overflow-wrap: anywhere;
}

.crumbs {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.crumbs a {
  color: var(--muted);
}

.post-card {
  display: block;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.post-card.with-cover {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.post-card .cover {
  width: 140px;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.post-card .cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-card .title {
  margin: 0 0 6px;
  font: 700 20px/1.35 var(--font-serif);
  overflow-wrap: anywhere;
}

.post-card .title a {
  color: var(--ink);
}

.post-card .meta {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.post-card .excerpt {
  margin: 0;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fde2e2;
  color: #7f1d1d;
  font-size: 12px;
  white-space: nowrap;
}

.badge.link {
  background: #fee2e2;
}

.badge a {
  color: inherit;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 22px 0 8px;
  font-size: 14px;
}

.pager a {
  color: var(--ink);
}

.pager .pagecount {
  color: var(--muted);
}

.panel {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.panel-title {
  margin: 0 0 10px;
  color: var(--ink);
  font: 700 16px/1.2 var(--font-sans);
  overflow-wrap: anywhere;
}

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

.panel li {
  padding: 4px 0;
  overflow-wrap: anywhere;
}

.panel .muted,
.muted {
  color: var(--muted);
}

.promo .btn-accent {
  display: inline-flex;
  margin-top: 8px;
}

.footer {
  padding: 22px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

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

.article h1 {
  margin: 0 0 6px;
  color: var(--ink);
  font: 800 34px/1.2 var(--font-serif);
  overflow-wrap: anywhere;
}

.article .post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.article .deck {
  margin: 8px 0 14px;
  color: #374151;
  font: 18px/1.6 var(--font-serif);
  overflow-wrap: anywhere;
}

.hero-img {
  margin: 12px 0 16px;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-img img {
  display: block;
  width: 100%;
  height: auto;
}

.toc {
  margin: 16px 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.toc .toc-list,
.toc .toc-sub {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc .toc-h2 > a {
  display: inline-block;
  padding: 4px 0;
  color: var(--ink);
  font-weight: 700;
}

.toc .toc-sub {
  margin: 2px 0 6px 14px;
}

.toc .toc-h3 > a {
  display: inline-block;
  padding: 2px 0;
  color: var(--muted);
  font-size: 14px;
}

.article-body {
  margin-top: 16px;
  font-size: 17.5px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.article-body h2,
.article-body h3,
.article-body h4 {
  margin: 22px 0 10px;
  color: var(--ink);
  font-family: var(--font-serif);
  overflow-wrap: anywhere;
}

.article-body p {
  margin: 10px 0;
}

.article-body blockquote {
  margin: 14px 0;
  padding: 6px 12px;
  border-left: 3px solid var(--accent);
  background: #fff;
  color: #334155;
}

.article-body code {
  padding: 2px 6px;
  border-radius: 6px;
  background: #f3f4f6;
}

.article-body pre {
  overflow: auto;
  padding: 14px;
  border-radius: 10px;
  background: #0b1021;
  color: #e5e7eb;
}

.source-link {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.related {
  margin-top: 26px;
}

.related h3 {
  margin: 0 0 10px;
  font: 700 18px/1.2 var(--font-sans);
}

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

.related li {
  padding: 4px 0;
  overflow-wrap: anywhere;
}

.tagset {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 10px 0 0;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.share-btn:hover {
  background: #fff7f7;
}

.share-btn.ok {
  outline: 2px solid var(--accent);
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .site-hero h1 {
    font-size: 32px;
  }

  .sidebar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .sidebar .panel {
    margin-bottom: 0;
  }

  .sidebar .rss-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .masthead .bar {
    grid-template-columns: minmax(0, 1fr) minmax(0, auto);
    gap: 8px 12px;
  }

  .brand {
    max-width: none;
  }

  .nav-aux {
    justify-content: flex-start;
    gap: 8px;
  }

  .searchbox {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
  }

  .searchbox input {
    width: 100%;
  }

  .rss-button,
  .lang-switch {
    flex: 0 1 auto;
  }

  .nav-cats {
    gap: 14px;
    padding-bottom: 5px;
  }

  .post-card.with-cover {
    display: block;
  }

  .post-card.with-cover .cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    margin-bottom: 14px;
  }

  .sidebar {
    display: block;
  }

  .sidebar .panel {
    margin-bottom: 16px;
  }

  .site-hero {
    margin-top: 4px;
    padding-inline: 2px;
  }

  .site-hero h1 {
    font-size: 28px;
  }

  .article h1 {
    font-size: 30px;
  }
}

@media (max-width: 420px) {
  .container {
    padding-inline: 16px;
  }

  .masthead .bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .nav-aux {
    justify-content: flex-start;
    width: 100%;
  }

  .rss-button {
    flex: 0 1 auto;
  }

  .lang-switch {
    flex: 0 1 auto;
    max-width: 100%;
  }

  .nav-cats {
    padding-bottom: 5px;
  }

  .actions .btn {
    flex: 1 1 auto;
  }
}
