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

html {
  color-scheme: dark;
  background: #000;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding-bottom: 140px;
  background: #000;
  color: #ededed;
  font-family: "Fira Sans", system-ui, -apple-system, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

::selection { background: #5ef2b0; color: #000; }

a { color: #5ef2b0; }

:focus-visible {
  outline: 2px solid #5ef2b0;
  outline-offset: 3px;
}

main {
  max-width: 1160px;
  margin: 0 auto;
  padding: 26px 20px 0;
  display: grid;
  grid-template-columns: 214px minmax(0, 1fr);
  gap: 38px;
  align-items: start;
}

/* ---------- 左侧目录 ---------- */
.rail {
  position: sticky;
  top: 24px;
  border: 1px solid #1d1d1d;
  border-radius: 10px;
  background: #0a0a0a;
  padding: 14px 12px 16px;
}

.rail-k {
  margin: 0 0 10px 4px;
  font-family: "Fira Code", ui-monospace, monospace;
  font-size: 16px;
  letter-spacing: .24em;
  color: #5ef2b0;
  text-shadow: 0 0 10px rgba(94, 242, 176, .45);
}

.rail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: rail;
}

.rail-list li + li { border-top: 1px solid #141414; }

.rail-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 4px;
  color: #cfcfcf;
  text-decoration: none;
  line-height: 1.35;
  transition: color .18s ease, background .18s ease;
}

.rail-list .n {
  font-family: "Fira Code", ui-monospace, monospace;
  font-size: 16px;
  color: #4b4b4b;
}

.rail-list a:hover,
.rail-list a:focus-visible {
  color: #5ef2b0;
  background: #101010;
}

.rail-list a:hover .n,
.rail-list a:focus-visible .n { color: #5ef2b0; }

/* ---------- 正文 ---------- */
.post { min-width: 0; max-width: 74ch; }

.hero {
  min-height: 45vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  text-align: right;
  padding-bottom: 22px;
}

.hero-txt { margin-left: auto; max-width: 40ch; }

.hero h1 {
  margin: 0;
  font-size: clamp(1.85rem, 4.4vw, 3.1rem);
  line-height: 1.14;
  letter-spacing: -.015em;
  color: #fff;
}

.hero-desc {
  margin: 14px 0 0 auto;
  max-width: 44ch;
  color: #9b9b9b;
  font-size: 17px;
}

.hero-media {
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid #1d1d1d;
  background: #0c0c0c;
}

.hero-media img {
  display: block;
  width: 100%;
  height: 30vh;
  min-height: 150px;
  object-fit: cover;
  transform: scale(1.06);
  will-change: transform;
}

.lead { margin: 26px 0 8px; }

article small {
  display: block;
  font-family: "Fira Code", ui-monospace, monospace;
  font-size: 16px;
  letter-spacing: .2em;
  color: #5ef2b0;
  text-shadow: 0 0 10px rgba(94, 242, 176, .35);
}

.lead h2 {
  margin: .18em 0 0;
  font-size: clamp(1.4rem, 2.6vw, 1.95rem);
  line-height: 1.25;
  font-weight: 600;
}

article > div[id] {
  margin-top: 18px;
  padding: 22px 20px;
  border: 1px solid #151515;
  border-radius: 10px;
  background: #0a0a0a;
  overflow-x: auto;
  scroll-margin-top: 24px;
  scroll-margin-bottom: 120px;
}

article > div[id] > :first-child { margin-top: 0; }
article > div[id] > :last-child { margin-bottom: 0; }

article h2 {
  margin: 0 0 .55em;
  font-size: clamp(1.3rem, 2.3vw, 1.7rem);
  line-height: 1.25;
  font-weight: 600;
  color: #fff;
}

article h3 {
  margin: 1.5em 0 .45em;
  font-size: 1.13rem;
  line-height: 1.35;
  color: #f0f0f0;
}

article p { margin: 0 0 1em; }

article ul, article ol { margin: 0 0 1em; padding-left: 1.35em; }
article li { margin: .3em 0; }

article strong { color: #fff; }

article blockquote {
  margin: 1.1em 0;
  padding: .7em 1.1em;
  border-left: 2px solid #5ef2b0;
  border-radius: 0 10px 10px 0;
  background: #0f0f0f;
  color: #bcbcbc;
}

article code {
  font-family: "Fira Code", ui-monospace, monospace;
  font-size: .93em;
  background: #161616;
  border-radius: 6px;
  padding: .1em .4em;
}

article pre {
  margin: 1em 0;
  padding: 14px;
  overflow-x: auto;
  background: #0d0d0d;
  border: 1px solid #1c1c1c;
  border-radius: 10px;
}

article pre code { background: none; padding: 0; }

article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

article th, article td {
  border: 1px solid #1d1d1d;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

article th { background: #121212; color: #fff; font-weight: 600; }

article img { max-width: 100%; height: auto; border-radius: 10px; }

article hr { border: 0; border-top: 1px solid #1d1d1d; margin: 1.6em 0; }

/* ---------- 底部胶囊导航 ---------- */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: rgba(0, 0, 0, .93);
  border-top: 1px solid #1d1d1d;
  backdrop-filter: blur(10px);
  padding: 9px 14px calc(9px + env(safe-area-inset-bottom));
}

.dock-in {
  max-width: 1160px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.links { display: contents; }

.dock ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 6px;
}

.dock .l { grid-column: 1; justify-content: flex-end; }
.dock .r { grid-column: 3; justify-content: flex-start; }

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid #232323;
  border-radius: 999px;
  background: #0b0b0b;
  color: #d6d6d6;
  font-size: 16px;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.pill:hover,
.pill:focus-visible {
  color: #5ef2b0;
  border-color: #3f7f66;
  box-shadow: 0 0 12px rgba(94, 242, 176, .22);
}

.pill[aria-current] {
  color: #000;
  background: #5ef2b0;
  border-color: #5ef2b0;
}

.dock .brand {
  grid-column: 2;
  justify-self: center;
  padding: 8px 6px;
  font-family: "Fira Code", ui-monospace, monospace;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .06em;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.find { grid-column: 4; display: flex; align-items: center; gap: 6px; }

.find input {
  width: 138px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid #232323;
  border-radius: 999px;
  background: #0b0b0b;
  color: #ededed;
  font: inherit;
  font-size: 16px;
}

.find input::placeholder { color: #6d6d6d; }

.find input:focus { border-color: #3f7f66; }

.find button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid #232323;
  border-radius: 999px;
  background: #121212;
  color: #d6d6d6;
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}

.find button:hover { color: #5ef2b0; border-color: #3f7f66; }

/* ---------- 页脚 ---------- */
.foot {
  max-width: 1160px;
  margin: 60px auto 0;
  padding: 26px 20px 0;
  border-top: 1px solid #1a1a1a;
}

.foot-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 22px;
}

.foot-brand {
  font-family: "Fira Code", ui-monospace, monospace;
  font-size: clamp(1.55rem, 5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.02em;
  color: #fff;
  text-decoration: none;
}

.foot-nav dl {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 12px;
}

.foot-nav dt {
  font-family: "Fira Code", ui-monospace, monospace;
  font-size: 16px;
  color: #434343;
}

.foot-nav dd { margin: 0; }

.foot-nav dd a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 4px 0;
  color: #cfcfcf;
  text-decoration: none;
  font-size: 16px;
}

.foot-nav dd a:hover,
.foot-nav dd a:focus-visible { color: #5ef2b0; }

.copy {
  margin: 0 0 0 auto;
  color: #6f6f6f;
  font-size: 16px;
}

/* ---------- 动效 ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .5s ease, transform .5s ease;
}

.js .reveal.in { opacity: 1; transform: none; }

.js .hero-media img { transition: transform .2s linear; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .js .hero-media img { transition: none; }
}

/* ---------- 窄屏 ---------- */
@media (max-width: 900px) {
  .find input { width: 118px; }
  main { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .rail { position: static; order: 2; }
  .post { order: 1; max-width: none; }
  .rail-list { display: flex; flex-wrap: wrap; gap: 6px 14px; }
  .rail-list li + li { border-top: 0; }
  .rail-list a { min-height: 40px; padding: 6px 4px; }
}

@media (max-width: 860px) {
  body { padding-bottom: 190px; }
  .dock-in {
    grid-template-columns: 1fr auto;
    grid-template-areas: "b f" "links links";
    gap: 8px;
  }
  .links {
    display: flex;
    grid-area: links;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .links::-webkit-scrollbar { display: none; }
  .dock ul { flex: 0 0 auto; }
  .dock .l, .dock .r { justify-content: flex-start; }
  .dock .brand { grid-area: b; justify-self: start; font-size: 16px; }
  .find { grid-area: f; justify-self: end; }
  .foot { margin-top: 44px; }
  .copy { flex-basis: 100%; margin: 6px 0 0; text-align: center; }
  .hero { min-height: 0; padding-bottom: 18px; }
  .hero-media img { height: 26vh; min-height: 130px; }
}

@media (max-width: 480px) {
  body { font-size: 17px; }
  main { padding: 18px 14px 0; }
  .foot { padding: 22px 14px 0; }
  article > div[id] { padding: 18px 14px; }
  .find input { width: 104px; }
  .pill { padding: 8px 12px; }
}

button[aria-expanded]{min-width:44px;min-height:44px}
