:root {
  color-scheme: dark;
  --canvas: #050506;
  --surface: #0d0d0f;
  --surface-elevated: #131316;
  --surface-hover: #17171b;
  --ink: #f4f4f6;
  --body: #d1d1d6;
  --mute: #8d8d96;
  --hairline: #27272c;
  --hairline-strong: #37373e;
  --accent: #b794f6;
  --accent-soft: rgba(139, 92, 246, 0.12);
  --accent-line: rgba(167, 139, 250, 0.42);
  --content-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 32px;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--canvas);
  color: var(--body);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC",
    system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.85;
  letter-spacing: 0.01em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.reading-progress {
  position: fixed;
  z-index: 20;
  inset: 0 0 auto;
  height: 3px;
  background: rgba(255, 255, 255, 0.04);
}

.reading-progress > span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 80ms linear;
}

.skip-link {
  position: fixed;
  z-index: 30;
  top: 14px;
  left: 14px;
  padding: 8px 14px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  background: var(--surface-elevated);
  color: var(--ink);
  transform: translateY(-160%);
}

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

.page-shell {
  width: min(calc(100% - 48px), var(--content-width));
  margin: 24px auto;
  padding: clamp(44px, 6vw, 76px);
  overflow: clip;
  border: 1px solid var(--hairline);
  border-radius: 20px;
  background: var(--surface);
}

.legal-hero {
  max-width: 850px;
  margin-inline: auto;
}

.eyebrow,
.notice-label,
.desktop-toc > p {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 780px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(34px, 4.3vw, 48px);
  font-weight: 720;
  line-height: 1.18;
  letter-spacing: -0.035em;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 11px;
  margin-top: 14px;
  color: var(--mute);
  font-size: 14px;
  line-height: 1.6;
}

.intro {
  margin-top: 34px;
}

.intro p {
  margin: 0;
  color: var(--body);
  font-size: 18px;
  line-height: 1.8;
}

.notice {
  max-width: 850px;
  margin: 44px auto 68px;
  padding: 28px 30px;
  border: 1px solid var(--accent-line);
  border-radius: 12px;
  background: var(--accent-soft);
}

.notice h2 {
  margin: 0 0 12px;
  color: #d8c2ff;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.35;
}

.notice p {
  margin: 10px 0 0;
  color: #ded7e9;
  line-height: 1.75;
}

.notice strong {
  color: var(--ink);
}

.legal-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 800px);
  gap: clamp(34px, 5vw, 64px);
  align-items: start;
  justify-content: center;
}

.desktop-toc {
  position: sticky;
  top: 32px;
  max-height: calc(100vh - 64px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.desktop-toc ol,
.mobile-toc ol {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.desktop-toc a,
.mobile-toc a {
  display: block;
  padding: 7px 10px;
  border-left: 1px solid var(--hairline);
  color: var(--mute);
  font-size: 13px;
  line-height: 1.45;
  text-decoration: none;
  transition:
    color 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.desktop-toc a:hover,
.mobile-toc a:hover {
  color: var(--body);
  background: var(--surface-hover);
}

.desktop-toc a[aria-current],
.mobile-toc a[aria-current] {
  border-left-color: var(--accent);
  background: var(--surface-elevated);
  color: var(--ink);
}

.mobile-toc {
  display: none;
  margin-top: 28px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface-elevated);
}

.mobile-toc summary {
  min-height: 44px;
  padding: 10px 14px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}

.mobile-toc ol {
  padding: 0 10px 12px;
}

.legal-document {
  min-width: 0;
}

.legal-document > section {
  margin-top: 68px;
}

.legal-document > section:first-child {
  margin-top: 0;
}

.legal-document h2 {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: baseline;
  margin: 0 0 20px;
  color: var(--ink);
  font-size: 27px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.section-index {
  color: var(--accent);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.legal-document h3 {
  margin: 34px 0 10px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 680;
  line-height: 1.5;
}

.legal-document p {
  margin: 0 0 16px;
}

.legal-document strong {
  color: var(--ink);
  font-weight: 680;
}

.legal-document ol,
.legal-document ul {
  display: grid;
  gap: 10px;
  margin: 16px 0 22px;
  padding-left: 1.45em;
}

.legal-document li {
  padding-left: 0.3em;
}

.legal-document code {
  padding: 2px 5px;
  border: 1px solid var(--hairline);
  border-radius: 5px;
  background: var(--surface-elevated);
  color: var(--ink);
  font: 0.88em/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.legal-document section:target h2 {
  color: #ffffff;
}

.legal-footer {
  max-width: 800px;
  margin: 82px auto 0;
  padding-top: 26px;
  border-top: 1px solid var(--hairline);
  color: var(--mute);
  font-size: 13px;
  line-height: 1.7;
}

.legal-footer p {
  margin: 4px 0;
}

@media (max-width: 900px) {
  .page-shell {
    width: min(calc(100% - 32px), 820px);
    padding: clamp(34px, 7vw, 56px);
  }

  .legal-layout {
    display: block;
  }

  .desktop-toc {
    display: none;
  }

  .mobile-toc {
    display: block;
  }

  .notice {
    margin-bottom: 58px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
    line-height: 1.82;
  }

  .page-shell {
    width: calc(100% - 20px);
    margin: 10px auto;
    padding: 30px 18px 40px;
    border-radius: 16px;
  }

  h1 {
    font-size: 32px;
    line-height: 1.24;
  }

  .intro {
    margin-top: 26px;
  }

  .intro p {
    font-size: 16px;
  }

  .notice {
    margin: 34px 0 50px;
    padding: 22px 18px;
  }

  .notice h2 {
    font-size: 20px;
  }

  .legal-document > section {
    margin-top: 54px;
  }

  .legal-document h2 {
    grid-template-columns: 1fr;
    gap: 4px;
    font-size: 23px;
  }

  .legal-document h3 {
    margin-top: 28px;
    font-size: 18px;
  }

  .legal-footer {
    margin-top: 62px;
  }
}

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
