:root {
  --page: #f6f5fa;
  --surface: #fff;
  --text: #20232b;
  --muted: #8a92a9;
  --line: #e9e8ef;
  --soft: #f8f8fb;
  --primary: #3858f6;
}

:root.dark {
  --page: #181818;
  --surface: #222;
  --text: #e9e9e9;
  --muted: #aaa;
  --line: #373737;
  --soft: #292929;
  --primary: #58a9d8;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--page); color: var(--text); font: 14px/1.75 Arial, "Microsoft YaHei", sans-serif; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--primary); }
img { display: block; max-width: 100%; }
.container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }

.site-header { position: relative; z-index: 50; border-top: 3px solid var(--primary); border-bottom: 1px solid var(--line); background: var(--surface); }
.header-inner { min-height: 68px; display: flex; align-items: center; }
.brand { width: 235px; padding-right: 24px; line-height: 1.2; }
.brand b { display: flex; min-height: 30px; align-items: center; color: var(--text); font-size: 24px; letter-spacing: -1px; }
.site-brand-logo { display: block; width: auto; max-width: 200px; height: 42px; object-fit: contain; object-position: left center; }
.brand small { display: block; overflow: hidden; margin-top: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.main-nav { display: flex; min-width: 0; flex: 1; align-items: center; }
.home-link,
.jm-nav-tree > li > a { display: block; box-sizing: border-box; margin: 16px 5px; padding: 8px 13px; border: 1px solid transparent; border-radius: 6px; font-weight: 700; line-height: 18px; transition: border-color .18s ease, color .18s ease, box-shadow .18s ease; }
.home-link:hover,
.jm-nav-tree > li:hover > a { border-color: var(--primary); box-shadow: 0 0 0 1px rgba(59, 91, 219, .08); color: var(--primary); }
.jm-nav-tree { display: flex; margin: 0; padding: 0; list-style: none; }
.jm-nav-tree li { position: relative; }
.jm-nav-tree ul { position: absolute; top: 100%; left: 0; display: none; width: 148px; margin: 0; padding: 4px 0; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); list-style: none; box-shadow: 0 5px 12px rgba(0,0,0,.08); }
.jm-nav-tree li:hover > ul, .jm-nav-tree li:focus-within > ul { display: block; }
.jm-nav-tree ul ul { top: -7px; left: 100%; }
.jm-nav-tree ul a { display: block; padding: 6px 12px; font-size: 13px; }
.jm-nav-tree ul a:hover { background: var(--soft); }
.header-tools { display: flex; gap: 4px; margin-left: 12px; align-items: center; }
.header-tools button,
.mobile-toggle { padding: 5px 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.header-tools button { display: grid; width: 32px; height: 32px; padding: 0; border-radius: 50%; place-items: center; line-height: 1; }
.header-tools svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.header-tools button:hover { background: var(--soft); color: var(--primary); }
.mobile-toggle { display: none; font-size: 20px; }
.search-panel { display: none; padding: 14px 0; border-top: 1px solid var(--line); background: var(--soft); }
.search-panel.open { display: block; }
.search-panel form { display: flex; width: min(680px, calc(100% - 32px)); margin: auto; }
.search-panel input,
.search-widget input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 0; outline: none; background: var(--surface); color: var(--text); }
.search-panel input:focus,
.search-widget input:focus { border-color: var(--primary); }
.search-panel button { width: 80px; border: 0; background: var(--primary); color: #fff; cursor: pointer; }

.page-layout,
.content-layout { display: grid; grid-template-columns: minmax(0, 820px) minmax(260px, 320px); gap: 28px; padding-top: 22px; padding-bottom: 42px; }
.primary { min-width: 0; }
.hero-slider { position: relative; height: 286px; overflow: hidden; border: 1px solid #d7d7d7; border-radius: 7px; background: linear-gradient(135deg, #243b64, #3858f6); }
.hero-slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .35s; }
.hero-slide:first-child { opacity: 1; visibility: visible; pointer-events: auto; }
.hero-slider:has(.active) .hero-slide:not(.active) { opacity: 0; visibility: hidden; pointer-events: none; }
.hero-slide.active { opacity: 1; visibility: visible; pointer-events: auto; }
.hero-slider:not(:has(.hero-slide)) { display: none; }
.hero-slide > img { width: 100%; height: 100%; object-fit: cover; }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0,0,0,.7), rgba(0,0,0,.02) 68%); }
.hero-copy { position: absolute; right: 28px; bottom: 25px; left: 28px; color: #fff; }
.hero-copy > span { padding: 3px 7px; background: var(--primary); font-size: 12px; }
.hero-copy h2 { max-width: 700px; margin: 8px 0 3px; font-size: 25px; line-height: 1.4; }
.hero-copy h2 a:hover { color: #fff; text-decoration: underline; }
.hero-copy p { max-width: 680px; margin: 0; color: #eee; }
.hero-dots { position: absolute; right: 14px; bottom: 13px; display: flex; gap: 5px; }
.hero-dots button { width: 18px; height: 3px; padding: 0; border: 0; background: rgba(255,255,255,.45); }
.hero-dots button.active { background: #fff; }

.hot-card,
.article-section,
.archive-head,
.post,
.widget { border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.hot-card { margin-top: 16px; padding: 15px 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-head h2 { margin: 0; padding-left: 10px; border-left: 3px solid var(--primary); font-size: 18px; font-weight: 600; line-height: 1.2; }
.section-head > span,
.section-head > a { color: var(--muted); font-size: 12px; }
.hot-card ol { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 5px 28px; margin: 0; padding: 0; list-style: none; counter-reset: hot; }
.hot-card li { display: flex; min-width: 0; align-items: center; gap: 8px; counter-increment: hot; }
.hot-card i::before { content: counter(hot); display: inline-block; width: 18px; color: var(--muted); font-style: normal; font-weight: 700; text-align: center; }
.hot-card li:nth-child(-n+3) i::before { color: #ff3737; }
.hot-card a { overflow: hidden; flex: 1; white-space: nowrap; text-overflow: ellipsis; }
.hot-card small { color: var(--muted); }

.article-section { margin-top: 16px; padding: 0; border: 0; background: transparent; }
.article-section > .section-head { margin-bottom: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.article-list { background: transparent; }
.primary > .article-list { padding: 0; border: 0; }
.article-card { display: flex; min-height: 135px; gap: 18px; margin-bottom: 13px; padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.article-card:last-child { margin-bottom: 0; }
.article-cover { position: relative; overflow: hidden; flex: 0 0 205px; height: 125px; border: 1px solid var(--line); background: linear-gradient(135deg, var(--soft), #dfe5ff); }
.article-card:not(:has(.article-cover))::before { content: ""; flex: 0 0 205px; height: 125px; border: 1px solid var(--line); background: linear-gradient(135deg, var(--soft), #dfe5ff); }
.article-cover img { width: 100%; height: 100%; object-fit: cover; }
.article-info { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.article-category { margin-left: auto; color: var(--muted); font-size: 12px; }
.article-info h2 { margin: 0 0 7px; font-size: 19px; font-weight: 600; line-height: 1.5; }
.article-info p { display: -webkit-box; overflow: hidden; margin: 0; color: var(--muted); line-height: 1.8; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
:root.dark .article-info p { color: var(--muted); }
.article-meta { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 18px; margin-top: auto; padding-top: 8px; color: var(--muted); font-size: 12px; }

.sidebar { display: flex; flex-direction: column; gap: 16px; }
.widget { padding: 15px 16px; }
.widget h3 { margin: 0 0 12px; padding: 0 0 8px; border-bottom: 2px solid var(--text); font-size: 16px; font-weight: 600; }
.widget h3::after { content: ""; display: block; width: 58px; margin-bottom: -10px; padding-top: 8px; border-bottom: 2px solid var(--primary); }
.mini-list { display: flex; flex-direction: column; }
.mini-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px dotted var(--line); }
.mini-item:last-child { border-bottom: 0; }
.mini-item img { width: 76px; height: 51px; object-fit: cover; }
.mini-item span { min-width: 0; flex: 1; }
.mini-item b { display: block; overflow: hidden; font-size: 13px; line-height: 1.5; white-space: nowrap; text-overflow: ellipsis; }
.mini-item small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.rank-list { margin: 0; padding: 0; list-style: none; counter-reset: rank; }
.rank-list li { position: relative; padding: 8px 0 8px 27px; border-bottom: 1px dotted var(--line); counter-increment: rank; }
.rank-list li:last-child { border-bottom: 0; }
.rank-list li::before { position: absolute; top: 9px; left: 0; content: counter(rank); width: 18px; height: 18px; background: #999; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.rank-list li:nth-child(-n+3)::before { background: #ff3737; }
.rank-list a { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rank-list small { color: var(--muted); font-size: 11px; }
.topic-list { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-list a { padding: 5px 9px; border: 1px solid var(--line); background: var(--soft); }
.topic-list span { font-size: 12px; }
.topic-list small { display: none; }
.friend-links { display: flex; flex-wrap: wrap; gap: 7px 12px; }
.friend-links a { color: #5c6477; font-size: 12px; }
.friend-links a:hover { color: var(--primary); }
.friend-links-empty { color: var(--muted); font-size: 12px; }

.archive-head { margin-bottom: 16px; padding: 18px 20px; border-top: 3px solid var(--primary); border-radius: 7px; }
.archive-head.wide { margin-top: 22px; }
.archive-head > span { color: var(--primary); font-size: 12px; }
.archive-head h1 { margin: 2px 0; font-size: 25px; font-weight: 600; }
.archive-head p { margin: 0; color: var(--muted); }
.empty-state { padding: 60px 20px; color: var(--muted); text-align: center; }
.jm-pagination { display: flex; min-height: 56px; margin: 22px 0; align-items: center; justify-content: space-between; }
.pagination-summary { padding: 8px 15px; border-radius: 7px; background: var(--soft); color: var(--muted); }
.pagination-actions { display: flex; gap: 8px; }
.jm-pagination a { min-width: 72px; height: 36px; padding: 0 14px; border: 1px solid var(--primary); border-radius: 7px; background: var(--primary); color: #fff; line-height: 34px; text-align: center; }
.jm-pagination a:hover { opacity: .88; color: #fff; }

.channel-grid,
.article-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.channel-grid > a,
.article-grid article { padding: 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.channel-grid h2,
.article-grid h2 { margin: 0 0 6px; font-size: 17px; }
.channel-grid p,
.article-grid p { color: var(--muted); }
.channel-grid span { color: var(--primary); }
.article-grid img { width: 100%; height: 150px; object-fit: cover; }

.content-layout { align-items: start; }
.post { min-width: 0; padding: 25px 28px; border-radius: 7px; }
.breadcrumb { display: flex; gap: 7px; padding-bottom: 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.post-head { padding: 22px 0; text-align: center; }
.post-tags { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.post-tag { padding: 2px 9px; border-radius: 12px; background: rgba(56,88,246,.09); color: var(--primary); font-size: 12px; font-weight: 400; }
.post-tag:hover { background: var(--primary); color: #fff; }
.post-head h1 { margin: 0 0 9px; font-size: 30px; font-weight: 600; line-height: 1.45; }
.post-head > div { display: flex; justify-content: center; gap: 18px; color: var(--muted); font-size: 12px; }
.post-cover { width: 100%; max-height: 460px; object-fit: cover; }
.post-body { padding: 24px 0; font-size: 16px; line-height: 1.95; }
.post-body img { height: auto; margin: 12px auto; }
.post-body pre { overflow: auto; padding: 16px; background: #252525; color: #eee; }
.post-body blockquote { margin: 18px 0; padding: 10px 16px; border-left: 3px solid var(--primary); background: var(--soft); }
.post-navigation { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.post-navigation a { padding: 10px; border: 1px solid var(--line); background: var(--soft); }
.post-navigation a:last-child { text-align: right; }
.post-navigation small { display: block; color: var(--muted); }
.post-navigation b { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.related { margin-top: 24px; }
.related-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.related-grid a { display: flex; align-items: center; gap: 9px; }
.related-grid img { width: 72px; height: 48px; object-fit: cover; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { min-height: 92px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.footer-inner b { color: var(--text); font-size: 16px; }
.footer-inner p { margin: 2px 0; }
.site-icp { margin-left: 8px; color: var(--muted); }
.site-icp:hover { color: var(--primary); }
.back-top { position: fixed; right: 20px; bottom: 20px; width: 36px; height: 36px; border: 0; opacity: 0; background: #555; color: #fff; cursor: pointer; transition: .2s; }
.back-top.show { opacity: 1; }

@media (max-width: 960px) {
  .header-inner { min-height: 60px; }
  .brand { width: auto; max-width: 60%; }
  .brand b { font-size: 21px; }
  .brand small { display: none; }
  .mobile-toggle { display: block; margin-left: auto; border-left: 0; }
  .main-nav { position: absolute; top: 60px; right: 0; left: 0; display: none; padding: 8px 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
  .main-nav.open { display: block; }
  .home-link,
  .jm-nav-tree > li > a { display: block; padding: 9px 5px; border-bottom: 1px solid var(--line); }
  .jm-nav-tree { display: block; }
  .jm-nav-tree ul { position: static; display: block; width: auto; margin-left: 16px; border: 0; box-shadow: none; }
  .header-tools { margin-left: 6px; }
  .page-layout,
  .content-layout { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .channel-grid,
  .article-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .container { width: calc(100% - 20px); }
  .header-tools .theme-toggle { display: none; }
  .hero-slider { height: 220px; }
  .hero-copy { right: 18px; bottom: 18px; left: 18px; }
  .hero-copy h2 { font-size: 21px; }
  .hero-copy p { display: none; }
  .hot-card ol { grid-template-columns: 1fr; }
  .hot-card li:nth-child(n+5) { display: none; }
  .article-section { padding: 14px; }
  .primary > .article-list { padding: 0 13px; }
  .article-card { min-height: 100px; gap: 11px; padding: 13px; }
  .article-cover { flex-basis: 122px; height: 84px; }
  .article-card:not(:has(.article-cover))::before { flex-basis: 122px; height: 84px; }
  .article-info h2 { font-size: 16px; }
  .article-info p { display: none; }
  .article-meta { margin-top: 4px; }
  .article-meta span:last-child { display: none; }
  .sidebar { display: block; }
  .widget { margin-bottom: 14px; }
  .channel-grid,
  .article-grid { grid-template-columns: 1fr; }
  .post { padding: 20px 16px; }
  .post-head h1 { font-size: 24px; }
  .post-head > div { flex-wrap: wrap; gap: 6px 12px; }
  .post-navigation,
  .related-grid { grid-template-columns: 1fr; }
  .footer-inner { display: block; min-height: 0; padding: 22px 0; }
  .footer-inner > p { margin-top: 10px; }
}

/* Keep wide data local instead of hiding overflow on the whole page. */
body { overflow-wrap: anywhere; }
.sidebar, .widget, .post, .related-grid > a, .post-navigation > a { min-width: 0; }
.post-body { min-width: 0; max-width: 100%; }
.post-body table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.post-body table td, .post-body table th { min-width: 90px; padding: 8px; border: 1px solid var(--line); }
.post-body pre { max-width: 100%; }
.breadcrumb, .article-meta { flex-wrap: wrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.hero-dots { z-index: 2; bottom: 7px; }
.hero-dots button { position: relative; width: 28px; height: 28px; background: transparent; cursor: pointer; }
.hero-dots button::after { content: ''; position: absolute; left: 4px; right: 4px; top: 12px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.5); }
.hero-dots button.active { background: transparent; }
.hero-dots button.active::after { background: #fff; }
.hero-pause { min-width: 28px; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.back-top { visibility: hidden; pointer-events: none; }
.back-top.show { visibility: visible; pointer-events: auto; }
.brand { flex-shrink: 0; min-width: 0; max-width: calc(100% - 120px); }
.brand b { overflow-wrap: anywhere; }
.header-tools { flex-shrink: 0; }
.home-link, .jm-nav-tree > li > a { white-space: nowrap; }
.site-header.nav-collapsed .mobile-toggle { display: block; margin-left: auto; }
.site-header.nav-collapsed .main-nav { position: absolute; top: 100%; left: 0; right: 0; display: none; max-height: 75vh; overflow-y: auto; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header.nav-collapsed .main-nav.open { display: block; }
.site-header.nav-collapsed .jm-nav-tree { display: block; }
.site-header.nav-collapsed .jm-nav-tree ul { position: static; display: block; width: auto; margin-left: 16px; border: 0; box-shadow: none; }
.site-header.nav-collapsed .jm-nav-tree a { white-space: normal; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .hero-slide { transition: none; } }
@media (max-width: 960px) {
  .main-nav { top: 100%; max-height: 75vh; overflow-y: auto; }
  .jm-nav-tree a { white-space: normal; }
}

.main-nav > * { flex-shrink: 0; }
.hero-dots .hero-pause { color: #fff; font-size: 16px; }
.hero-dots .hero-pause::after { display: none; }

.post-cover { height: auto; aspect-ratio: 820 / 460; }
.brand b { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
