@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

:root {
  --ink: #000000;
  --paper: #ffffff;
  --soft: #f2f2f2;
  --dim: #6a6a6a;
  --pixel: 'Press Start 2P', 'VT323', ui-monospace, 'Courier New', monospace;
  --ui: 'VT323', system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --maxw: 1200px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.7;
  letter-spacing: 0.01em;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 2px solid var(--ink);
  border-radius: 4px;
}

section[id] {
  scroll-margin-top: 96px;
}

.skip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 80;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 18px;
  font-size: 16px;
  text-decoration: none;
  transform: translateY(-140%);
  transition: transform 0.2s linear;
}

.skip:focus {
  transform: translateY(0);
}

/* 顶部细条 */
.ticker {
  background: var(--ink);
  color: var(--paper);
}

.ticker__in {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 8px 24px;
  font-family: var(--pixel);
  font-size: 10px;
  letter-spacing: 0.16em;
  line-height: 1.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 导航 */
.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
}

.nav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 6px 24px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.nav__wing {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav__wing--l {
  justify-content: flex-end;
}

.nav__item {
  position: relative;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  color: var(--ink);
  font-size: 16px;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color 0.22s ease, background-color 0.22s ease;
}

.nav__link:hover,
.nav__link:focus-visible {
  border-bottom-color: var(--ink);
  background: var(--soft);
}

.nav__brand {
  text-align: center;
  white-space: nowrap;
}

.nav__brand a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 8px;
  color: var(--ink);
  font-family: var(--pixel);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.submenu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 60;
  display: none;
  min-width: 168px;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 4px;
}

.nav__item--sub:hover > .submenu,
.nav__item--sub:focus-within > .submenu {
  display: block;
}

.submenu a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  color: var(--ink);
  font-size: 16px;
  text-decoration: none;
}

.submenu a:hover,
.submenu a:focus-visible {
  background: var(--ink);
  color: var(--paper);
}

/* 主栅格 */
.page {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  column-gap: 40px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px 72px;
}

/* 首屏 */
.hero {
  grid-column: 1 / -1;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 20px;
  min-height: calc(100vh - 36px);
  min-height: calc(100svh - 36px);
  padding: 72px 0 210px;
  text-align: right;
}

.hero__h1 {
  margin: 0;
  font-family: var(--pixel);
  font-size: clamp(2rem, 8vw, 5.8rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
}

.hero__desc {
  margin: 0;
  max-width: 52ch;
  font-size: clamp(17px, 1.5vw, 19px);
  line-height: 1.6;
}

.hero::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: clamp(88px, 17vh, 180px);
  background: var(--ink);
  clip-path: polygon(0 100%, 100% 0, 100% 100%);
}

/* 侧栏 */
.rail {
  position: sticky;
  top: 92px;
  align-self: start;
  margin-top: 56px;
  padding: 16px 14px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
}

.rail h2 {
  margin: 0;
  font-family: var(--pixel);
  font-size: 12px;
  letter-spacing: 0.12em;
  line-height: 1.5;
}

.rail ul {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.rail li {
  border-top: 1px solid var(--ink);
  animation: railIn 0.46s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.rail li:first-child {
  border-top: 0;
}

.rail li:nth-child(1) { animation-delay: 0.03s; }
.rail li:nth-child(2) { animation-delay: 0.06s; }
.rail li:nth-child(3) { animation-delay: 0.09s; }
.rail li:nth-child(4) { animation-delay: 0.12s; }
.rail li:nth-child(5) { animation-delay: 0.15s; }
.rail li:nth-child(6) { animation-delay: 0.18s; }
.rail li:nth-child(7) { animation-delay: 0.21s; }

.rail a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 2px;
  color: var(--ink);
  font-size: 16px;
  text-decoration: none;
  transition: padding-left 0.2s ease, background-color 0.2s ease;
}

.rail a:hover,
.rail a:focus-visible {
  padding-left: 8px;
  background: var(--soft);
}

@keyframes railIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 正文 */
.doc {
  min-width: 0;
  margin-top: 56px;
}

.doc > section[id] {
  margin-top: 48px;
  padding-top: 36px;
  border-top: 2px solid var(--ink);
}

.doc > section[id]:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.doc h2 {
  margin: 0 0 16px;
  font-family: var(--pixel);
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.doc h3 {
  margin: 28px 0 12px;
  font-family: var(--pixel);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.35;
}

h2 > span,
h3 > span {
  display: inline-block;
}

h2 > span::before,
h3 > span::before {
  content: '';
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-right: 0.45em;
  vertical-align: 0.05em;
  background: currentColor;
}

.doc p {
  max-width: 68ch;
  margin: 0 0 18px;
}

.doc a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid var(--ink);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.doc a:hover,
.doc a:focus-visible {
  background: var(--ink);
  color: var(--paper);
}

.doc ul,
.doc ol {
  max-width: 68ch;
  margin: 0 0 20px;
  padding-left: 22px;
}

.doc li {
  margin-bottom: 8px;
}

.doc blockquote {
  margin: 24px 0;
  padding: 14px 18px;
  border: 2px solid var(--ink);
  border-radius: 4px;
}

.doc blockquote p:last-child {
  margin-bottom: 0;
}

.doc figure {
  margin: 28px 0;
}

.doc figcaption {
  margin-top: 8px;
  font-size: 16px;
  color: var(--dim);
}

.doc pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 14px 16px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  font-family: var(--pixel);
  font-size: 13px;
  line-height: 1.7;
}

.doc code {
  font-family: var(--pixel);
  font-size: 13px;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 16px;
}

.doc th,
.doc td {
  border: 2px solid var(--ink);
  padding: 10px 12px;
  text-align: left;
}

.endcap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 48px;
  padding-top: 28px;
  border-top: 2px solid var(--ink);
}

.endcap h2 {
  margin: 0;
  font-size: 16px;
}

.endcap p {
  margin: 0;
}

.endcap__a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 16px;
  border: 2px solid var(--ink) !important;
  border-radius: 4px;
  font-size: 16px;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.endcap__a:hover,
.endcap__a:focus-visible {
  background: var(--ink) !important;
  color: var(--paper) !important;
}

/* 页脚 */
.foot {
  background: var(--ink);
  color: var(--paper);
  border-top: 2px solid var(--ink);
}

.foot__in {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 56px 24px 24px;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 40px;
  border-bottom: 2px solid var(--paper);
}

.cta h2 {
  margin: 0;
  font-family: var(--pixel);
  font-size: clamp(1.6rem, 5vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.cta__btn {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 12px 28px;
  color: var(--paper);
  font-size: 16px;
  text-decoration: none;
  border: 2px solid var(--paper);
  border-radius: 4px;
  transition: background-color 0.22s ease, color 0.22s ease;
}

.cta__btn:hover,
.cta__btn:focus-visible {
  background: var(--paper);
  color: var(--ink);
}

.foot__cols {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 32px;
  padding: 40px 0;
}

.foot dl {
  margin: 0;
}

.foot dt {
  margin-bottom: 12px;
  font-family: var(--pixel);
  font-size: 11px;
  letter-spacing: 0.12em;
  line-height: 1.6;
}

.foot dd {
  margin: 0;
}

.foot dd a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  color: var(--paper);
  font-size: 16px;
  text-decoration: none;
  border-bottom: 1px solid #555555;
  transition: border-color 0.2s ease;
}

.foot dd a:hover,
.foot dd a:focus-visible {
  border-bottom-color: var(--paper);
}

.foot__mark a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  color: var(--paper);
  font-family: var(--pixel);
  font-size: 14px;
  line-height: 1.6;
  text-decoration: none;
}

.foot__end {
  margin: 0;
  padding-top: 18px;
  border-top: 1px solid #555555;
  font-size: 16px;
  letter-spacing: 0.02em;
}

/* 窄屏 */
@media (max-width: 860px) {
  .masthead {
    position: static;
  }

  .nav {
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 6px 14px 10px;
  }

  .nav__brand {
    grid-column: 1 / -1;
    order: -1;
    padding-bottom: 6px;
    margin-bottom: 8px;
    border-bottom: 2px solid var(--ink);
  }

  .nav__wing {
    flex-direction: column;
    align-items: stretch;
  }

  .nav__wing--l,
  .nav__wing--r {
    justify-content: flex-start;
  }

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

  .nav__wing--r .nav__link,
  .nav__wing--r .submenu a {
    justify-content: flex-end;
  }

  .nav__wing--r .nav__item--sub > .nav__link {
    justify-content: flex-end;
  }

  .submenu {
    position: static;
    display: block;
    min-width: 0;
    margin: 0 4px 6px;
    padding: 0 0 0 10px;
    border: 0;
    border-left: 2px solid var(--ink);
    border-radius: 0;
  }

  .submenu a {
    justify-content: flex-end;
  }

  section[id] {
    scroll-margin-top: 16px;
  }

  .page {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 16px 56px;
  }

  .hero {
    min-height: 0;
    padding: 32px 0 110px;
    gap: 14px;
  }

  .hero::after {
    height: 72px;
  }

  .rail {
    position: static;
    margin-top: 32px;
  }

  .doc {
    margin-top: 32px;
  }

  .doc > section[id] {
    margin-top: 36px;
    padding-top: 26px;
  }

  .foot__cols {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding: 32px 0;
  }

  .cta {
    flex-direction: column;
    align-items: flex-start;
  }

  .foot__in {
    padding: 40px 16px 20px;
  }
}

@media (max-width: 420px) {
  body {
    font-size: 16px;
  }

  .hero__h1 {
    font-size: clamp(1.8rem, 10vw, 2.6rem);
  }

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

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