:root {
  color-scheme: dark;
  --bg: #05090d;
  --bg-soft: #071118;
  --panel: rgba(9, 20, 28, 0.78);
  --panel-strong: rgba(12, 25, 34, 0.92);
  --line: rgba(144, 225, 255, 0.18);
  --line-strong: rgba(156, 242, 255, 0.44);
  --text: #e9f7fb;
  --muted: #8fa5b3;
  --dim: #5d7481;
  --cyan: #9cf2ff;
  --blue: #57b7e8;
  --violet: #8f7dff;
  --green: #61f2aa;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", "Microsoft YaHei UI", monospace;
  --sans: Inter, "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 68% 16%, rgba(87, 183, 232, 0.12), transparent 28rem),
    radial-gradient(circle at 22% 52%, rgba(143, 125, 255, 0.08), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  letter-spacing: 0;
}

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

img {
  max-width: 100%;
  display: block;
}

code,
pre {
  font-family: var(--mono);
}

.stars,
.grid-horizon {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
}

.stars {
  background-image:
    radial-gradient(circle, rgba(156, 242, 255, 0.7) 0 1px, transparent 1px),
    radial-gradient(circle, rgba(255, 255, 255, 0.32) 0 1px, transparent 1px);
  background-position: 0 0, 18px 32px;
  background-size: 120px 120px, 180px 180px;
  opacity: 0.25;
  animation: drift 42s linear infinite;
}

.grid-horizon {
  background:
    linear-gradient(rgba(156, 242, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(156, 242, 255, 0.06) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, transparent, black 10%, black 70%, transparent);
  opacity: 0.48;
  transform: perspective(900px) rotateX(60deg) translateY(-18%);
  transform-origin: top;
}

.site-shell {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 30px 28px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(5, 12, 18, 0.96), rgba(5, 12, 18, 0.72));
  box-shadow: var(--shadow);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: 21px;
  color: var(--text);
}

.brand-mark {
  width: 18px;
  height: 18px;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 24px rgba(156, 242, 255, 0.7);
  position: relative;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 7px -8px;
  border-top: 1px solid var(--cyan);
}

.brand-mark::after {
  inset: -8px 7px;
  border-top: 0;
  border-left: 1px solid var(--cyan);
}

.identity {
  margin: 34px 0 26px;
  text-align: center;
}

.orbit-avatar {
  width: 160px;
  height: 160px;
  margin: 0 auto 18px;
  border: 1px solid rgba(156, 242, 255, 0.22);
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, transparent 0 17px, rgba(156, 242, 255, 0.16) 18px 19px),
    radial-gradient(circle, rgba(156, 242, 255, 0.2), transparent 44%);
  position: relative;
}

.orbit-avatar span {
  position: absolute;
  inset: 52px;
  border-radius: 50%;
  background: linear-gradient(150deg, #d7f8ff, #34556d 52%, #071118);
  box-shadow: 0 0 42px rgba(156, 242, 255, 0.22);
}

.identity h1 {
  margin: 0;
  font-family: var(--mono);
  font-size: 27px;
  font-weight: 500;
}

.identity p {
  margin: 10px 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.status-line {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--green);
  font-family: var(--mono);
  font-size: 12px;
}

.status-line span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 18px rgba(97, 242, 170, 0.9);
}

.counts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.counts div {
  padding: 14px 8px;
  text-align: center;
  border-right: 1px solid var(--line);
}

.counts div:last-child {
  border-right: 0;
}

.counts span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.counts b {
  display: block;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 500;
}

.side-nav {
  border: 1px solid var(--line);
  margin-bottom: 20px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 15px;
  border-bottom: 1px solid rgba(144, 225, 255, 0.1);
  color: #d9edf4;
  transition: background 0.2s ease, color 0.2s ease;
}

.side-nav a:last-child {
  border-bottom: 0;
}

.side-nav a:hover {
  background: rgba(156, 242, 255, 0.08);
  color: var(--cyan);
}

.nav-glyph {
  width: 17px;
  height: 17px;
  border: 1px solid currentColor;
  opacity: 0.9;
}

.nav-home {
  clip-path: polygon(50% 0, 100% 38%, 100% 100%, 0 100%, 0 38%);
}

.nav-archive {
  border-radius: 2px;
}

.nav-tag {
  transform: rotate(45deg);
}

.nav-info {
  border-radius: 50%;
}

.side-search {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: rgba(4, 10, 15, 0.5);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.side-search svg,
.icon-button svg,
.post-arrow svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-search kbd {
  margin-left: auto;
  border: 1px solid var(--line);
  padding: 2px 8px;
  color: var(--cyan);
  font-family: var(--mono);
}

.side-widget {
  margin-top: 26px;
}

.side-widget h2 {
  margin: 0 0 12px;
  color: #dff9ff;
  font-size: 16px;
  font-weight: 500;
}

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

.category-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px dotted rgba(156, 242, 255, 0.22);
  color: var(--muted);
}

.category-list a:hover,
.tag-cloud a:hover {
  color: var(--cyan);
}

.tag-cloud,
.index-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-cloud a,
.index-cloud a,
.related-tags a {
  border: 1px solid rgba(144, 225, 255, 0.2);
  padding: 7px 10px;
  color: var(--muted);
  font-size: 13px;
  background: rgba(156, 242, 255, 0.03);
}

.side-footer {
  margin-top: 36px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 12px;
}

.status-table {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 16px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.status-table b {
  color: var(--cyan);
  font-weight: 400;
}

.main-panel {
  min-width: 0;
  overflow-x: hidden;
  border-right: 1px solid rgba(144, 225, 255, 0.14);
}

.topbar {
  height: 66px;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(4, 9, 13, 0.78);
  backdrop-filter: blur(18px);
}

.crumb {
  color: #d9edf4;
  font-size: 14px;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  background: transparent;
  color: #dff9ff;
  font: inherit;
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--line);
  color: var(--cyan);
  background: rgba(156, 242, 255, 0.05);
}

.menu-toggle {
  display: none;
}

.menu-toggle span {
  width: 18px;
  height: 1px;
  background: currentColor;
  margin: 3px 0;
}

.home-intro,
.listing-page,
.about-page {
  padding: 68px clamp(26px, 6vw, 90px) 28px;
}

.home-intro.compact {
  padding-bottom: 8px;
}

.home-intro p {
  margin: 0 0 12px;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 13px;
}

.home-intro h1,
.listing-page h1,
.about-page h1 {
  max-width: 840px;
  margin: 0;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.1;
  font-weight: 520;
  overflow-wrap: anywhere;
}

.post-feed {
  padding: 18px clamp(20px, 5vw, 70px) 80px;
}

.post-row {
  position: relative;
  display: grid;
  grid-template-columns: 34px 150px minmax(0, 1fr) 54px;
  gap: 20px;
  min-height: 156px;
  padding: 28px 0;
  border-bottom: 1px solid rgba(144, 225, 255, 0.13);
}

.post-row::before {
  content: "";
  position: absolute;
  inset: 14px -18px;
  border: 1px solid transparent;
  background: linear-gradient(90deg, rgba(156, 242, 255, 0.08), transparent 70%);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: -1;
}

.post-row:hover::before {
  opacity: 1;
}

.post-timeline {
  position: relative;
}

.post-timeline::before {
  content: "";
  position: absolute;
  top: -28px;
  bottom: -28px;
  left: 50%;
  width: 1px;
  background: var(--line);
}

.post-timeline span {
  position: absolute;
  top: 24px;
  left: 50%;
  width: 14px;
  height: 14px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  transform: translateX(-50%);
}

.post-meta {
  display: flex;
  flex-direction: column;
  gap: 9px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
}

.post-meta time {
  color: var(--blue);
}

.post-main h2 {
  margin: 0 0 12px;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.18;
  font-weight: 540;
  overflow-wrap: anywhere;
}

.post-main p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.post-arrow {
  align-self: center;
  justify-self: end;
  color: #dff9ff;
}

.post-index {
  position: absolute;
  right: 0;
  bottom: 18px;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 13px;
}

.article-shell {
  padding: 0 clamp(22px, 4vw, 66px) 90px;
}

.reading-progress {
  position: fixed;
  top: 0;
  left: 380px;
  right: 0;
  height: 2px;
  z-index: 50;
  transform-origin: left;
  transform: scaleX(0);
  background: var(--cyan);
  box-shadow: 0 0 20px rgba(156, 242, 255, 0.85);
}

.article-head {
  padding: 44px 0 26px;
}

.article-head h1 {
  margin: 0;
  max-width: 980px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.16;
  font-weight: 540;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 16px 0 26px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
}

.article-cover,
.article-body img {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.24);
}

.article-cover {
  max-height: 420px;
  object-fit: cover;
}

.article-grid {
  display: grid;
  grid-template-columns: minmax(0, 820px) 260px;
  gap: clamp(28px, 5vw, 76px);
  align-items: start;
}

.article-body {
  color: #dceaf0;
  font-size: 16px;
  line-height: 1.95;
}

.article-body h2,
.article-body h3 {
  scroll-margin-top: 90px;
  margin: 42px 0 14px;
  line-height: 1.35;
  font-weight: 560;
}

.article-body h2 {
  font-size: 25px;
  border-left: 3px solid var(--cyan);
  padding-left: 14px;
}

.article-body h3 {
  font-size: 20px;
  color: var(--cyan);
}

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

.article-body a {
  color: var(--cyan);
  border-bottom: 1px solid rgba(156, 242, 255, 0.36);
}

.article-body blockquote {
  margin: 28px 0;
  padding: 18px 22px;
  border-left: 3px solid var(--cyan);
  color: var(--muted);
  background: rgba(156, 242, 255, 0.05);
}

.article-body pre {
  overflow: auto;
  margin: 24px 0;
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(2, 6, 10, 0.72);
  color: #c8f4ff;
  line-height: 1.7;
}

.article-body code {
  color: #bff6ff;
}

.article-body :not(pre) > code {
  padding: 2px 6px;
  border: 1px solid rgba(144, 225, 255, 0.18);
  background: rgba(156, 242, 255, 0.05);
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  border: 1px solid var(--line);
}

.article-body th,
.article-body td {
  padding: 11px 12px;
  border: 1px solid rgba(144, 225, 255, 0.16);
}

.toc-rail {
  position: sticky;
  top: 96px;
  padding-left: 22px;
  border-left: 1px solid var(--line);
  color: var(--muted);
}

.toc-rail h2 {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
}

.toc-rail nav {
  display: grid;
  gap: 12px;
}

.toc-rail a:hover {
  color: var(--cyan);
}

.toc-depth-3 {
  padding-left: 14px;
  color: var(--dim);
}

.related-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.backtop {
  display: inline-block;
  margin-top: 26px;
  border: 1px solid var(--line);
  padding: 9px 14px;
}

.listing-page h1,
.about-page h1 {
  margin-bottom: 32px;
}

.archive-year {
  max-width: 920px;
  margin: 0 0 38px;
}

.archive-year h2 {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 500;
}

.archive-item {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) auto;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.archive-item span {
  color: var(--text);
}

.archive-item b {
  color: var(--cyan);
  font-weight: 400;
}

.index-cloud {
  max-width: 820px;
}

.index-cloud a {
  font-size: 16px;
}

.index-cloud span {
  margin-left: 10px;
  color: var(--cyan);
}

.about-page {
  max-width: 1040px;
}

.about-page p {
  color: var(--muted);
  line-height: 1.9;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 30px;
}

.about-grid section {
  border: 1px solid var(--line);
  padding: 22px;
  background: rgba(156, 242, 255, 0.04);
}

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: start center;
  padding-top: 13vh;
  background: rgba(2, 6, 9, 0.72);
  backdrop-filter: blur(16px);
}

.search-overlay[hidden] {
  display: none;
}

.search-dialog {
  width: min(720px, calc(100vw - 32px));
  border: 1px solid var(--line-strong);
  background: rgba(6, 14, 20, 0.96);
  box-shadow: var(--shadow);
}

.search-dialog-head {
  display: flex;
  border-bottom: 1px solid var(--line);
}

.search-dialog input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 18px;
  font: 16px var(--sans);
  outline: none;
}

.search-results {
  display: grid;
  gap: 1px;
  padding: 10px;
}

.search-results a,
.empty-search {
  padding: 14px;
  background: rgba(156, 242, 255, 0.04);
}

.search-results b,
.search-results span {
  display: block;
}

.search-results span,
.empty-search {
  margin-top: 7px;
  color: var(--muted);
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-120px, 120px, 0); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 980px) {
  .site-shell {
    display: block;
    width: 100vw;
    max-width: 100vw;
  }

  .main-panel {
    width: 100vw;
    max-width: 100vw;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(340px, 88vw);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 80;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .menu-toggle {
    display: inline-grid;
  }

  .topbar-actions {
    display: none;
  }

  .reading-progress {
    left: 0;
  }

  .post-row {
    grid-template-columns: 26px minmax(0, 1fr) 42px;
  }

  .post-meta {
    grid-column: 2 / 4;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .post-main {
    grid-column: 2 / 3;
  }

  .article-grid {
    grid-template-columns: 1fr;
  }

  .toc-rail {
    position: static;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 20px 0 0;
  }

  .home-intro h1,
  .listing-page h1,
  .about-page h1,
  .article-head h1 {
    max-width: 340px;
    font-size: 30px;
    line-height: 1.18;
  }

  .post-main {
    max-width: 320px;
  }

  .home-intro h1,
  .listing-page h1,
  .about-page h1,
  .article-head h1,
  .post-main h2,
  .post-main p {
    overflow-wrap: anywhere;
    word-break: break-all;
    line-break: anywhere;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 0 16px;
  }

  .home-intro,
  .listing-page,
  .about-page,
  .article-shell {
    padding-left: 18px;
    padding-right: 18px;
  }

  .post-feed {
    padding-left: 18px;
    padding-right: 18px;
  }

  .post-row {
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 12px;
    min-height: 0;
  }

  .post-meta,
  .post-main {
    grid-column: 2 / 3;
  }

  .post-main h2 {
    font-size: 23px;
  }

  .post-main p {
    font-size: 15px;
  }

  .post-arrow {
    display: none;
  }

  .post-index {
    display: none;
  }

  .archive-item,
  .about-grid {
    grid-template-columns: 1fr;
  }
}
