:root {
  --bg: #f7f7f7;
  --card: #ffffff;
  --text: #222222;
  --muted: #666666;
  --link: #1a5fb4;
  --border: #e2e2e2;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 14px;
}

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-grid {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 64px;
}
.header-left {
  display: flex;
  align-items: center;
}
.icon-link {
  width: 44px;
  height: 44px;
  justify-content: center;
}
.site-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #1a5fb4;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.site-icon.site-icon-img {
  padding: 0;
  background: transparent;
  object-fit: cover;
  display: block;
}

.header-center {
  text-align: center;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
.header-center a {
  color: #222;
}
.nav-sep {
  color: #8d8d8d;
  font-size: 13px;
}

.header-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.search-trigger {
  border: 1px solid #d0d0d0;
  background: #fff;
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.search-form { margin: 0; }
.search-input {
  width: 100%;
  border: 1px solid #d0d0d0;
  border-radius: 3px;
  padding: 6px 10px;
  font-size: 14px;
  outline: none;
}
.search-input:focus { border-color: #8ab4f8; }

.hero {
  padding: 8px 0 10px;
}
.hero h1 {
  margin: 0 0 8px;
  font-size: 32px;
}
.muted { color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding-bottom: 18px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 16px;
}
.card-title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 500;
}
.meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tag {
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  padding: 2px 10px;
  text-decoration: none;
}
a.tag:hover {
  border-color: #8ab4f8;
  color: var(--link);
  text-decoration: none;
}
.empty {
  background: #fff;
  border: 1px dashed #ccc;
  padding: 16px;
}

.content-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
  padding-top: 14px;
  min-height: calc(100vh - 120px);
}
.content-layout--with-toc {
  grid-template-columns: 260px minmax(0, 1fr) 220px;
  max-width: 1320px;
}
.article-list-pane,
.article-content-pane {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.article-list-pane {
  padding: 10px;
  align-self: start;
  position: sticky;
  top: 78px;
  max-height: calc(100vh - 96px);
  overflow: auto;
}
.pane-title {
  margin: 4px 6px 10px;
  font-size: 15px;
}
.article-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.article-list-item {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
}
.article-list-item + .article-list-item {
  margin-top: 6px;
}
.article-list-item:hover {
  background: #fafafa;
  border-color: #efefef;
}
.article-list-item.is-active {
  background: #f4f8ff;
  border-color: #d8e4ff;
}
.article-list-item a {
  display: block;
  width: 100%;
  height: 100%;
  padding: 8px 10px;
  color: #222;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.article-list-item a:hover,
.article-list-item a:focus-visible {
  text-decoration: none;
}
.article-list-title {
  display: block;
}

.article-content-pane {
  padding: 16px 18px;
}

.prose { padding: 4px 0 18px; }
.breadcrumbs {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}
.prose h1 {
  margin: 6px 0 10px;
  font-size: 34px;
  font-weight: 500;
}
.prose h2 { margin: 22px 0 8px; font-size: 26px; font-weight: 500; }
.prose h3 { margin: 18px 0 6px; font-size: 20px; font-weight: 500; }
.prose p { margin: 10px 0; }
.prose ul { padding-left: 22px; }
.prose img {
  max-width: 100%;
  height: auto;
  display: block;
}
.prose blockquote {
  margin: 14px 0;
  padding: 6px 12px;
  border-left: 3px solid #ccc;
  color: #555;
  background: #fcfcfc;
}
.prose pre {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.prose pre.mermaid {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fafafa;
  padding: 12px;
  margin: 14px 0;
}
.prose pre.mermaid svg {
  display: block;
  max-width: none;
  height: auto;
}
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 14px;
}
.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.prose thead th {
  background: #f5f5f5;
  font-weight: 600;
}

.site-footer {
  background: #fff;
  border-top: 1px solid var(--border);
  color: var(--muted);
  padding: 16px 0;
  margin-top: 12px;
}
.site-footer .container {
  text-align: center;
}

.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 12px 12px;
}
.search-overlay.open {
  display: flex;
}
.search-modal {
  width: min(820px, 100%);
  background: #fff;
  border-radius: 8px;
  border: 1px solid #ddd;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  padding: 14px;
}
.search-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.search-close {
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
}
.search-inline-results {
  margin-top: 12px;
  max-height: 56vh;
  overflow: auto;
}

/* Mobile: full width, same list/content ratio as desktop (260:1fr ≈ 26:74), no TOC aside */
@media (max-width: 760px) {
  .container {
    max-width: none;
    width: 100%;
    padding: 0 8px;
  }

  .header-grid {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 52px;
  }
  .header-center {
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    font-size: 12px;
    gap: 6px;
    scrollbar-width: none;
  }
  .header-center::-webkit-scrollbar {
    display: none;
  }
  .header-center a,
  .nav-sep {
    flex-shrink: 0;
    white-space: nowrap;
  }
  .search-trigger {
    padding: 6px 12px;
    font-size: 13px;
    min-width: 3.5em;
  }

  .content-layout,
  .content-layout--with-toc {
    width: 100%;
    max-width: none;
    grid-template-columns: minmax(0, 26%) minmax(0, 1fr);
    gap: 8px;
    padding-top: 8px;
    min-height: 0;
  }
  .post-toc-aside {
    display: none !important;
  }
  .article-list-pane {
    padding: 6px;
    top: 56px;
    max-height: calc(100vh - 64px);
  }
  .pane-title {
    font-size: 13px;
    margin: 2px 4px 6px;
  }
  .article-list-item a {
    padding: 6px 8px;
  }
  .article-list-title {
    font-size: 12px;
    line-height: 1.35;
    word-break: break-word;
  }
  .article-list-item .meta {
    display: none;
  }
  .article-content-pane {
    padding: 10px 12px;
    min-width: 0;
  }

  .hero h1 { font-size: 24px; }
  .prose h1 { font-size: 24px; line-height: 1.3; }
  .prose h2 { font-size: 20px; }
  .prose h3 { font-size: 17px; }
  .prose h2[id],
  .prose h3[id],
  .prose h4[id] {
    scroll-margin-top: 72px;
  }

  .prose table {
    font-size: 12px;
  }
  .prose th,
  .prose td {
    padding: 6px 8px;
  }
  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 14px 0;
    border: 1px solid var(--border);
    border-radius: 4px;
  }
  .table-scroll table {
    margin: 0;
    min-width: 480px;
  }

  .code-block-wrap pre.shiki,
  .code-block-wrap pre.code-block {
    font-size: 12px;
    padding: 2rem 2.75rem 0.65rem 0.65rem;
  }

  .prose pre.mermaid svg {
    max-width: 100%;
    height: auto;
  }

  .post-nav {
    flex-direction: column;
  }
  .post-nav-link {
    flex: 1 1 auto;
    text-align: left;
  }
  .post-nav-next {
    text-align: left;
  }
}

.post-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.reading-time::before {
  content: "·";
  margin-right: 12px;
  color: #ccc;
}

.post-toc-aside {
  align-self: start;
  min-width: 0;
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 110px);
  overflow: auto;
}
.post-toc-aside .post-toc {
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fafafa;
}
.post-toc-aside .post-toc::before {
  content: "本页目录";
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14px;
}
.post-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.post-toc ul ul {
  padding-left: 14px;
}
.post-toc a {
  display: block;
  padding: 3px 0;
  color: var(--muted);
  text-decoration: none;
}
.post-toc a:hover,
.post-toc a.is-active {
  color: var(--link);
}

.prose h2[id],
.prose h3[id],
.prose h4[id] {
  scroll-margin-top: 88px;
}
.prose h2 .header-anchor,
.prose h3 .header-anchor,
.prose h4 .header-anchor {
  opacity: 0;
  margin-right: 6px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 400;
}
.prose h2:hover .header-anchor,
.prose h3:hover .header-anchor,
.prose h4:hover .header-anchor {
  opacity: 1;
}

.admonition {
  margin: 14px 0;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.admonition-title {
  margin: 0 0 6px;
  font-weight: 600;
  font-size: 14px;
}
.admonition-tip { background: #f0f9f4; border-color: #b8e0c8; }
.admonition-warning { background: #fff8e6; border-color: #f0d78c; }
.admonition-danger { background: #fff0f0; border-color: #f0b8b8; }
.admonition-info { background: #f0f6ff; border-color: #b8d4f8; }
.admonition-note { background: #f7f7f7; border-color: #ddd; }

.prose .task-list-item {
  list-style: none;
}
.prose .task-list-item input {
  margin-right: 8px;
}

.code-block-wrap {
  position: relative;
  margin: 14px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.code-block-wrap pre {
  margin: 0;
  border: none;
  border-radius: 0;
}
.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  z-index: 1;
}
.code-lang-label {
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 11px;
  color: var(--muted);
  text-transform: lowercase;
  z-index: 1;
}
.image-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.image-lightbox.open {
  display: flex;
}
.image-lightbox img {
  max-width: min(96vw, 1200px);
  max-height: 90vh;
  object-fit: contain;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  line-height: 1;
}

.related-posts { margin-top: 20px; }
.related-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.related-list li {
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}
.related-list li:last-child { border-bottom: none; }
.related-list .meta {
  display: block;
  margin: 2px 0 0;
}

.post-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.post-nav-link {
  flex: 1 1 200px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fafafa;
  color: #222;
  text-decoration: none;
  font-size: 14px;
}
.post-nav-link:hover {
  border-color: #8ab4f8;
  text-decoration: none;
}
.post-nav-next { text-align: right; }

.tag-cloud {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.tag-cloud li {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
}

.post-encrypted-badge {
  font-size: 14px;
  font-weight: 600;
  color: #8a4b00;
  background: #fff8e6;
  border: 1px solid #f0d78c;
  border-radius: 4px;
  padding: 2px 8px;
  vertical-align: middle;
}
.article-lock {
  opacity: 0.75;
}
.article-list-item.is-encrypted .article-list-title {
  color: #555;
}
.post-encrypt-gate {
  margin: 16px 0;
}
.post-encrypt-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-top: 12px;
}
.post-encrypt-label {
  width: 100%;
  font-size: 13px;
  color: var(--muted);
}
.post-encrypt-input {
  flex: 1 1 180px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 15px;
}
.post-encrypt-submit {
  border: 1px solid #1a5fb4;
  background: #1a5fb4;
  color: #fff;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
}
.post-encrypt-submit:hover {
  background: #164f96;
}
.post-encrypt-error {
  margin: 10px 0 0;
  color: #b42318;
  font-size: 13px;
}
.post-body-locked[hidden] {
  display: none !important;
}
.post-encrypt-gate[hidden] {
  display: none !important;
}
#post-decrypted-content .post-toc {
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fafafa;
  font-size: 13px;
}
#post-decrypted-content .post-toc::before {
  content: "本页目录";
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

.locale-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.locale-switcher-label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.locale-select {
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  padding: 6px 28px 6px 10px;
  font-size: 13px;
  line-height: 1.2;
  color: #222;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M2 4l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 8px center;
  background-size: 12px;
  appearance: none;
  cursor: pointer;
  max-width: 140px;
}
.locale-select:hover {
  border-color: #8ab4f8;
}
.locale-select:focus {
  outline: none;
  border-color: #1a5fb4;
  box-shadow: 0 0 0 2px rgba(26, 95, 180, 0.15);
}
.affiliate-disclosure {
  margin: 0 0 6px;
  font-size: 12px;
}
/* Product recommendation cards (not code blocks) */
.prose .product-card {
  display: grid;
  grid-template-columns: minmax(148px, 200px) 1fr;
  gap: 0;
  margin: 28px 0;
  padding: 0;
  border: 1px solid #e4e4e7;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  font-family: inherit;
}
.prose .product-card a {
  text-decoration: none;
}
.prose .product-card-media {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 20px;
  background: linear-gradient(145deg, #eef2ff 0%, #f1f5f9 55%, #e2e8f0 100%);
  border-right: 1px solid #e8ecf1;
}
.prose .product-card-media img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}
.prose .product-card-placeholder {
  display: block;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='1.5'%3E%3Cpath d='M3 7h18l-2 11H5L3 7z'/%3E%3Cpath d='M8 7V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'/%3E%3C/svg%3E") center / 44px no-repeat;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}
.prose .product-card-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 24px;
}
.prose .product-card-badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1e3a5f;
  background: #dbeafe;
  border-radius: 999px;
  padding: 4px 10px;
}
.prose .product-card-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
}
.prose .product-card-title a {
  color: #0f172a;
}
.prose .product-card-title a:hover {
  color: #1a5fb4;
}
.prose .product-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
}
.prose .product-card-price,
.prose .product-card-rating {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
}
.prose .product-card-meta .meta-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}
.prose .product-card-meta .meta-value {
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
}
.prose .product-card-rating .meta-value {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.prose .product-star {
  display: inline-block;
  width: 16px;
  height: 16px;
  background-size: contain;
  background-repeat: no-repeat;
}
.prose .product-star--full {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23f59e0b'%3E%3Cpath d='M10 1.5l2.47 5.01 5.53.8-4 3.9.94 5.5L10 14.9l-4.94 2.6.94-5.5-4-3.9 5.53-.8L10 1.5z'/%3E%3C/svg%3E");
}
.prose .product-star--half {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cdefs%3E%3ClinearGradient id='h'%3E%3Cstop offset='50%25' stop-color='%23f59e0b'/%3E%3Cstop offset='50%25' stop-color='%23e2e8f0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath fill='url(%23h)' d='M10 1.5l2.47 5.01 5.53.8-4 3.9.94 5.5L10 14.9l-4.94 2.6.94-5.5-4-3.9 5.53-.8L10 1.5z'/%3E%3C/svg%3E");
}
.prose .product-star--empty {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23e2e8f0'%3E%3Cpath d='M10 1.5l2.47 5.01 5.53.8-4 3.9.94 5.5L10 14.9l-4.94 2.6.94-5.5-4-3.9 5.53-.8L10 1.5z'/%3E%3C/svg%3E");
}
.prose .rating-text {
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
}
.prose .product-card-note {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #475569;
}
.prose .product-card-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  margin-top: 4px;
  padding: 12px 22px;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffad33 0%, #ff9900 100%);
  color: #1a1200 !important;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 2px 0 #cc7a00, 0 6px 16px rgba(255, 153, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.prose .product-card-cta:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 2px 0 #cc7a00, 0 10px 22px rgba(255, 153, 0, 0.4);
}
.prose .product-card-cta span::after {
  content: " →";
}
.pick-card .card-title a {
  font-size: 17px;
}
@media (max-width: 640px) {
  .prose .product-card {
    grid-template-columns: 1fr;
  }
  .prose .product-card-media {
    min-height: 140px;
    border-right: none;
    border-bottom: 1px solid #e8ecf1;
  }
  .prose .product-card-cta {
    align-self: stretch;
  }
  .locale-switcher-label {
    display: none;
  }
}

