:root {
  --ink: #0a0e27;
  --ink-2: #12183a;
  --cream: #f5f5f0;
  --brown: #2a1e0f;
  --acid: #39ff14;
  --silver: #c0c0c0;
  --orange: #ff6b35;
  --white: #ffffff;
  --danger: #e63946;
  --font-display: "Arial Black", "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", monospace;
  --shadow-hard: 6px 6px 0 rgba(0, 0, 0, 0.4);
  --header-h: 84px;
  --maxw: 1280px;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--white);
  background-color: var(--ink);
  background-image: linear-gradient(rgba(192, 192, 192, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(192, 192, 192, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
}

#main-content {
  flex: 1 0 auto;
  width: 100%;
  display: block;
  scroll-margin-top: 96px;
}

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

a {
  color: var(--acid);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  text-decoration: underline;
}

button {
  font: inherit;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  cursor: pointer;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: 3px solid var(--acid);
  outline-offset: 2px;
}

::selection {
  background: var(--acid);
  color: var(--ink);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--ink);
}

::-webkit-scrollbar-thumb {
  background: var(--acid);
  border: 2px solid var(--ink);
}

.shell {
  width: min(100% - 40px, var(--maxw));
  margin-inline: auto;
}

.shell--narrow {
  width: min(100% - 40px, 760px);
  margin-inline: auto;
}

@media (max-width: 600px) {
  .shell, .shell--narrow {
    width: min(100% - 24px, var(--maxw));
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 2000;
  padding: 12px 24px;
  background: var(--acid);
  color: var(--ink);
  font-weight: 800;
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--orange);
  transition: top 0.2s ease;
}

.skip-link:focus-visible {
  top: 16px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--ink);
  border-bottom: 2px solid var(--silver);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  width: min(100% - 40px, var(--maxw));
  margin-inline: auto;
  min-height: var(--header-h);
  padding: 10px 0;
}

.site-header__slash {
  height: 10px;
  background: var(--acid);
  border-top: 2px solid var(--silver);
  -webkit-clip-path: polygon(0 0, 100% 0, calc(100% - 96px) 100%, 0 100%);
  clip-path: polygon(0 0, 100% 0, calc(100% - 96px) 100%, 0 100%);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
}

.site-brand:hover {
  color: var(--white);
  text-decoration: none;
}

.site-brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  background: var(--acid);
  color: var(--ink);
  font: 900 26px/1 var(--font-display);
  border: 2px solid var(--silver);
  box-shadow: 4px 4px 0 var(--orange);
}

.site-brand__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.site-brand__name {
  font: 900 22px/1 var(--font-display);
  color: var(--white);
  letter-spacing: 0.04em;
}

.site-brand__suffix {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--silver);
}

.site-brand--footer:hover {
  text-decoration: none;
}

@media (max-width: 600px) {
  .site-brand__mark {
    width: 40px;
    height: 40px;
    font-size: 22px;
  }
  .site-brand__name {
    font-size: 18px;
  }
  .site-brand__suffix {
    font-size: 10px;
  }
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--silver);
  padding: 10px 14px;
  background: var(--ink-2);
  color: var(--white);
  font-weight: 700;
  line-height: 1;
  box-shadow: 4px 4px 0 var(--silver);
}

.nav-toggle:hover {
  border-color: var(--acid);
  color: var(--acid);
}

.nav-toggle__icon {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 18px;
  height: 14px;
}

.nav-toggle__icon span {
  display: block;
  height: 2px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle.is-active {
  border-color: var(--acid);
  color: var(--acid);
  box-shadow: 4px 4px 0 var(--acid);
}

.nav-toggle.is-active .nav-toggle__icon span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle.is-active .nav-toggle__icon span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-active .nav-toggle__icon span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.nav-toggle__text {
  font-size: 14px;
}

@media (min-width: 1000px) {
  .nav-toggle {
    display: none;
  }
}

.site-nav-wrap {
  display: none;
  flex-basis: 100%;
  flex-direction: column;
  gap: 16px;
  padding: 16px 0 4px;
  border-top: 2px solid var(--silver);
  margin-top: 4px;
}

.site-nav-wrap[data-open="true"],
.site-nav-wrap.is-open {
  display: flex;
}

.site-nav-wrap nav {
  display: flex;
  width: 100%;
}

.site-nav-wrap ul {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.site-nav-wrap ul a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 6px;
  color: var(--white);
  font-weight: 700;
  font-size: 16px;
  border-bottom: 1px solid rgba(192, 192, 192, 0.25);
}

.site-nav-wrap ul a::before {
  content: attr(data-index);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--orange);
}

.site-nav-wrap ul a:hover {
  color: var(--acid);
  text-decoration: none;
  background: rgba(57, 255, 20, 0.06);
}

.site-nav-wrap ul a[aria-current="page"] {
  color: var(--acid);
  border-left: 4px solid var(--acid);
  padding-left: 12px;
}

@media (min-width: 1000px) {
  .site-nav-wrap {
    display: flex;
    flex: 1;
    flex-direction: row;
    flex-basis: auto;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    border-top: 0;
    margin-top: 0;
    padding: 0;
  }
  .site-nav-wrap[data-open="true"],
  .site-nav-wrap.is-open {
    display: flex;
  }
  .site-nav-wrap nav {
    display: flex;
    width: auto;
  }
  .site-nav-wrap ul {
    flex-direction: row;
    width: auto;
    gap: 2px;
  }
  .site-nav-wrap ul a {
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    border-left: 0;
    color: var(--silver);
  }
  .site-nav-wrap ul a::before {
    content: attr(data-index);
    color: var(--silver);
    font-size: 10px;
    opacity: 0.85;
  }
  .site-nav-wrap ul a:hover {
    color: var(--white);
    background: transparent;
    border-bottom-color: var(--silver);
  }
  .site-nav-wrap ul a[aria-current="page"] {
    color: var(--acid);
    border-bottom-color: var(--acid);
    padding-left: 10px;
  }
}

.header-search-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  margin-top: 4px;
  padding: 10px 16px;
  background: var(--acid);
  color: var(--ink);
  border: 2px solid var(--white);
  box-shadow: 4px 4px 0 var(--orange);
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
  letter-spacing: 0.04em;
}

.header-search-link:hover {
  text-decoration: none;
  background: var(--orange);
  border-color: var(--silver);
}

.header-search-link__label {
  white-space: nowrap;
}

.header-search-link__icon {
  font-size: 20px;
  line-height: 1;
}

@media (min-width: 1000px) {
  .header-search-link {
    margin-top: 0;
    align-self: auto;
  }
}

.site-footer {
  flex-shrink: 0;
  position: relative;
  background: var(--ink-2);
  border-top: 6px solid var(--acid);
}

.site-footer::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 0;
  width: 120px;
  height: 6px;
  background: var(--orange);
  -webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  width: min(100% - 40px, var(--maxw));
  margin-inline: auto;
  padding: 48px 0 40px;
}

@media (min-width: 600px) and (max-width: 999px) {
  .site-footer__grid {
    grid-template-columns: 1fr 1fr;
  }
  .site-footer__brand {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1000px) {
  .site-footer__grid {
    grid-template-columns: 1.5fr 0.8fr 0.8fr 1.3fr;
    gap: 48px;
  }
}

.site-footer__brand .site-brand {
  margin-bottom: 16px;
}

.site-footer__intro {
  color: var(--silver);
  font-size: 14px;
  max-width: 42ch;
}

.site-footer__trust {
  margin-top: 20px;
  padding: 12px 14px;
  border: 1px dashed var(--acid);
  color: var(--acid);
  background: rgba(57, 255, 20, 0.06);
  font-size: 13px;
  line-height: 1.5;
}

.footer-title {
  font: 700 14px/1.4 var(--font-display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--acid);
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--silver);
}

.footer-link-list {
  display: grid;
  gap: 8px;
}

.footer-link-list a {
  color: var(--silver);
  font-size: 14px;
}

.footer-link-list a:hover {
  color: var(--acid);
  text-decoration: none;
}

.footer-contact-line {
  margin: 0 0 6px;
  color: var(--white);
  font-size: 14px;
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  align-items: center;
  border-top: 2px solid var(--silver);
  background: var(--ink);
  padding: 16px 20px;
  width: min(100%, var(--maxw));
  margin-inline: auto;
}

.site-footer__bottom p {
  margin: 0;
  font-size: 13px;
  color: var(--silver);
}

.scroll-progress,
[data-scroll-progress] {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 4px;
  background: var(--acid);
  z-index: 2200;
  pointer-events: none;
}

.scroll-top,
[data-scroll-top] {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2100;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  background: var(--acid);
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--orange);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.scroll-top.is-visible,
[data-scroll-top].is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top:hover,
[data-scroll-top]:hover {
  background: var(--orange);
}

@media (max-width: 600px) {
  .scroll-top,
  [data-scroll-top] {
    right: 16px;
    bottom: 16px;
    width: 46px;
    height: 46px;
    font-size: 20px;
  }
}

.page-path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 14px 18px;
  background: var(--ink-2);
  border: 2px solid var(--silver);
  box-shadow: 4px 4px 0 var(--silver);
  margin-bottom: 32px;
}

.page-path a {
  color: var(--silver);
  font-size: 14px;
  font-weight: 600;
}

.page-path a:hover {
  color: var(--acid);
  text-decoration: none;
}

.page-path__sep {
  color: var(--orange);
  font-family: var(--font-mono);
}

.page-path [aria-current="page"] {
  color: var(--acid);
  pointer-events: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: 2px solid var(--silver);
  background: var(--ink-2);
  color: var(--white);
  font-weight: 800;
  font-size: 15px;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  box-shadow: 4px 4px 0 var(--silver);
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.12s ease, border-color 0.15s ease;
}

.btn:hover {
  text-decoration: none;
  background: var(--silver);
  color: var(--ink);
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--silver);
}

.btn:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 var(--silver);
}

.btn--primary {
  background: var(--acid);
  border-color: var(--ink);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--orange);
}

.btn--primary:hover {
  background: var(--orange);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--orange);
}

.btn--outline {
  background: transparent;
  border-color: var(--acid);
  color: var(--acid);
  box-shadow: 4px 4px 0 rgba(57, 255, 20, 0.5);
}

.btn--outline:hover {
  background: var(--acid);
  color: var(--ink);
  box-shadow: 2px 2px 0 rgba(57, 255, 20, 0.5);
}

.btn--block {
  width: 100%;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.4;
  border: 1px solid transparent;
}

.tag--acid {
  color: var(--ink);
  background: var(--acid);
  border-color: var(--acid);
}

.tag--accent {
  color: var(--ink);
  background: var(--orange);
  border-color: var(--orange);
}

.tag--silver {
  color: var(--silver);
  background: transparent;
  border-color: var(--silver);
}

.tag--danger {
  color: var(--white);
  background: transparent;
  border-color: var(--danger);
}

.card-panel {
  background: var(--ink-2);
  border: 2px solid var(--silver);
  box-shadow: var(--shadow-hard);
  padding: 28px;
}

.data-line {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--acid);
  background: rgba(57, 255, 20, 0.08);
  border: 1px solid rgba(57, 255, 20, 0.35);
  padding: 8px 12px;
}

.prose {
  background: var(--cream);
  color: var(--brown);
  border: 2px solid var(--silver);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.4);
  padding: clamp(20px, 4vw, 48px);
}

.prose__title {
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 40px);
  color: var(--brown);
  line-height: 1.2;
  margin: 0 0 12px;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--font-display);
  color: var(--brown);
  line-height: 1.2;
}

.prose p {
  margin: 0 0 1.2em;
}

.prose a {
  color: var(--orange);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
  margin-bottom: 1.2em;
}

.prose ul {
  list-style: square;
}

.prose li {
  margin-bottom: 0.4em;
}

.prose blockquote {
  border-left: 4px solid var(--orange);
  margin: 1.4em 0;
  padding: 8px 16px;
  font-style: italic;
  color: var(--brown);
}

.section-number {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--orange);
  letter-spacing: 0.1em;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 38px);
  color: var(--white);
  line-height: 1.2;
  margin-bottom: 20px;
}

.section-title::before {
  content: "/";
  color: var(--acid);
  font-family: var(--font-mono);
  font-size: 0.8em;
}

.chapter-index {
  border-top: 2px solid var(--silver);
}

.chapter-index a {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 16px;
  align-items: baseline;
  padding: 18px 8px;
  border-bottom: 2px solid var(--silver);
  color: var(--white);
  transition: background 0.15s ease, color 0.15s ease;
}

.chapter-index a:hover {
  background: var(--ink-2);
  color: var(--acid);
  text-decoration: none;
}

.chapter-index a::after {
  content: "→";
  color: var(--silver);
  font-size: 18px;
  transition: transform 0.15s ease, color 0.15s ease;
}

.chapter-index a:hover::after {
  color: var(--orange);
  transform: translateX(4px);
}

.chapter-index__num {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--orange);
}

.chapter-index__title {
  font-family: var(--font-display);
  font-size: 20px;
}

.grid-list {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
}

@media (min-width: 600px) {
  .grid-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1000px) {
  .grid-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

.media-frame {
  border: 2px solid var(--silver);
  background: var(--ink-2);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.4);
}

.media-frame__figure {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  aspect-ratio: var(--media-ratio, 16 / 9);
  background: linear-gradient(135deg, var(--ink-2) 0%, var(--ink) 100%);
  color: var(--silver);
}

.media-frame__caption {
  padding: 10px 14px;
  border-top: 1px solid rgba(192, 192, 192, 0.4);
  color: var(--silver);
  font-size: 13px;
}

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