:root {
  --legal-ink: #172927;
  --legal-muted: #667673;
  --legal-brand: #55c4b7;
  --legal-brand-dark: #153f3a;
  --legal-brand-deep: #0d2e2a;
  --legal-mist: #eef8f6;
  --legal-line: #dce9e6;
  --legal-paper: #ffffff;
  --legal-canvas: #f4f8f7;
  --legal-shadow: 0 24px 70px rgba(19, 62, 57, 0.1);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--legal-ink);
  background:
    radial-gradient(circle at 12% 16%, rgba(85, 196, 183, 0.1), transparent 24rem),
    linear-gradient(180deg, #edf7f5 0, var(--legal-canvas) 28rem, var(--legal-canvas) 100%);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.legal-shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.legal-header {
  position: sticky;
  z-index: 40;
  top: 0;
  color: #fff;
  background: rgba(13, 46, 42, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 30px rgba(4, 26, 23, 0.16);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.legal-header__inner {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.legal-brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  text-decoration: none;
}

.legal-brand img {
  display: block;
  width: auto;
  height: 42px;
}

.legal-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  margin: 0;
  list-style: none;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
}

.legal-switcher a {
  display: block;
  padding: 7px 16px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
  border-radius: 999px;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.legal-switcher a:hover,
.legal-switcher a:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.legal-switcher a[aria-current="page"] {
  color: #103b36;
  background: #fff;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.15);
}

.legal-hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 82% 8%, rgba(108, 221, 208, 0.28), transparent 22rem),
    linear-gradient(135deg, var(--legal-brand-deep), #185e56 72%, #277b71);
}

.legal-hero::after {
  position: absolute;
  right: -130px;
  bottom: -230px;
  width: 460px;
  height: 460px;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  box-shadow:
    0 0 0 52px rgba(255, 255, 255, 0.025),
    0 0 0 112px rgba(255, 255, 255, 0.018);
}

.legal-hero__inner {
  position: relative;
  z-index: 1;
  padding: 76px 0 82px;
}

.legal-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 20px;
  color: #a9eee5;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.legal-eyebrow::before {
  width: 28px;
  height: 1px;
  content: "";
  background: currentColor;
}

.legal-hero h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(36px, 6vw, 62px);
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: -0.035em;
}

.legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 28px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
}

.legal-meta span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legal-meta span::before {
  width: 6px;
  height: 6px;
  content: "";
  background: var(--legal-brand);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(85, 196, 183, 0.14);
}

.legal-layout {
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
  gap: 34px;
  align-items: start;
  padding: 48px 0 82px;
}

.legal-toc {
  position: sticky;
  top: 102px;
  max-height: calc(100vh - 126px);
  padding: 22px 14px 22px 20px;
  overflow: auto;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(212, 230, 226, 0.88);
  border-radius: 18px;
  box-shadow: 0 15px 40px rgba(29, 77, 70, 0.06);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  scrollbar-color: #b7d5d0 transparent;
  scrollbar-width: thin;
}

.legal-toc__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--legal-brand-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.legal-toc__title::before {
  width: 4px;
  height: 14px;
  content: "";
  background: var(--legal-brand);
  border-radius: 10px;
}

.legal-toc ol {
  display: grid;
  gap: 2px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.legal-toc a {
  display: block;
  padding: 7px 9px;
  color: #657673;
  font-size: 13px;
  line-height: 1.45;
  text-decoration: none;
  border-radius: 9px;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.legal-toc a:hover,
.legal-toc a:focus-visible {
  color: var(--legal-brand-dark);
  background: var(--legal-mist);
  transform: translateX(2px);
}

.legal-document {
  overflow: hidden;
  background: var(--legal-paper);
  border: 1px solid rgba(211, 228, 224, 0.92);
  border-radius: 26px;
  box-shadow: var(--legal-shadow);
}

.legal-prose {
  padding: clamp(30px, 5vw, 62px) clamp(24px, 6vw, 76px) 66px;
}

.legal-intro {
  padding-bottom: 32px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--legal-line);
}

.legal-prose section {
  position: relative;
  padding: 28px 0 24px;
  border-bottom: 1px solid var(--legal-line);
}

.legal-prose section:last-child {
  padding-bottom: 4px;
  border-bottom: 0;
}

.legal-prose h2 {
  position: relative;
  padding-left: 18px;
  margin: 0 0 19px;
  color: var(--legal-brand-dark);
  font-size: clamp(21px, 2.4vw, 27px);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.legal-prose h2::before {
  position: absolute;
  top: 0.25em;
  bottom: 0.22em;
  left: 0;
  width: 5px;
  content: "";
  background: linear-gradient(180deg, var(--legal-brand), #277b71);
  border-radius: 99px;
}

.legal-prose p {
  margin: 0;
  color: #3f514e;
  font-size: 16px;
  line-height: 1.95;
  text-align: justify;
  text-justify: inter-ideograph;
}

.legal-prose p + p {
  margin-top: 1.08em;
}

.legal-prose p.doc-no-gap {
  margin-top: 0.18em;
}

.legal-prose strong {
  color: inherit;
  font-weight: 700;
}

.legal-prose u {
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

.legal-prose a {
  color: #1f786e;
  overflow-wrap: anywhere;
  text-decoration-color: rgba(31, 120, 110, 0.35);
  text-underline-offset: 3px;
}

.legal-list {
  display: grid;
  gap: 14px;
  padding: 0;
  margin: 1.08em 0 0;
  list-style: none;
}

.legal-list + p {
  margin-top: 1.08em;
}

.legal-list--compact {
  gap: 7px;
}

.legal-list li {
  position: relative;
  padding: 13px 16px 13px 43px;
  color: #3f514e;
  line-height: 1.8;
  background: #f7fbfa;
  border: 1px solid #e5efed;
  border-radius: 12px;
}

.legal-list li::before {
  position: absolute;
  top: 19px;
  left: 19px;
  width: 8px;
  height: 8px;
  content: "";
  background: var(--legal-brand);
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(85, 196, 183, 0.12);
}

.sdk-grid {
  display: grid;
  gap: 14px;
  margin: 20px 0 12px;
}

.sdk-card {
  padding: 20px 22px;
  background: linear-gradient(145deg, #f3faf8, #fff);
  border: 1px solid #dcece8;
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(27, 82, 73, 0.045);
}

.sdk-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.75;
  text-align: left;
}

.sdk-card p + p {
  margin-top: 7px;
}

.sdk-card p:first-child {
  margin-bottom: 10px;
  color: var(--legal-brand-dark);
  font-size: 16px;
  font-weight: 700;
}

.legal-signature {
  padding-top: 10px;
  color: var(--legal-brand-dark) !important;
  font-weight: 700;
  text-align: right !important;
}

.legal-footer {
  color: rgba(255, 255, 255, 0.66);
  background: var(--legal-brand-deep);
}

.legal-footer__inner {
  min-height: 132px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 26px 0;
}

.legal-footer p {
  margin: 0;
  font-size: 13px;
  line-height: 1.75;
}

.legal-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 22px;
}

.legal-footer a {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  text-decoration: none;
}

.legal-footer a:hover,
.legal-footer a:focus-visible {
  color: #fff;
}

.back-to-top {
  position: fixed;
  z-index: 30;
  right: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  text-decoration: none;
  background: var(--legal-brand-dark);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  box-shadow: 0 12px 30px rgba(11, 49, 44, 0.22);
  transition: transform 0.2s ease, background 0.2s ease;
}

.back-to-top:hover,
.back-to-top:focus-visible {
  background: #1f756b;
  transform: translateY(-3px);
}

:focus-visible {
  outline: 3px solid rgba(91, 210, 196, 0.45);
  outline-offset: 3px;
}

@media (max-width: 940px) {
  html {
    scroll-padding-top: 92px;
  }

  .legal-layout {
    grid-template-columns: 1fr;
    gap: 22px;
    padding-top: 30px;
  }

  .legal-toc {
    position: static;
    max-height: none;
    padding: 16px;
    overflow: hidden;
  }

  .legal-toc__title {
    margin-bottom: 10px;
  }

  .legal-toc ol {
    grid-auto-columns: max-content;
    grid-auto-flow: column;
    display: grid;
    gap: 6px;
    padding-bottom: 3px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  .legal-toc a {
    padding: 8px 12px;
    background: #f4f9f8;
    border: 1px solid #e4efec;
  }

  .legal-toc a:hover,
  .legal-toc a:focus-visible {
    transform: translateY(-1px);
  }
}

@media (max-width: 680px) {
  body {
    font-size: 15px;
  }

  .legal-shell {
    width: min(100% - 28px, 1180px);
  }

  .legal-header__inner {
    min-height: 68px;
    gap: 12px;
  }

  .legal-brand img {
    height: 32px;
  }

  .legal-switcher {
    gap: 2px;
    padding: 4px;
  }

  .legal-switcher a {
    padding: 6px 10px;
    font-size: 12px;
  }

  .legal-hero__inner {
    padding: 54px 0 58px;
  }

  .legal-eyebrow {
    margin-bottom: 15px;
    font-size: 12px;
  }

  .legal-meta {
    display: grid;
    gap: 6px;
    margin-top: 22px;
  }

  .legal-layout {
    padding-bottom: 48px;
  }

  .legal-document {
    border-radius: 18px;
  }

  .legal-prose {
    padding: 28px 20px 38px;
  }

  .legal-prose section {
    padding: 24px 0 19px;
  }

  .legal-prose h2 {
    padding-left: 14px;
    margin-bottom: 15px;
    font-size: 20px;
  }

  .legal-prose h2::before {
    width: 4px;
  }

  .legal-prose p {
    font-size: 15px;
    line-height: 1.85;
    text-align: left;
  }

  .legal-list {
    gap: 8px;
  }

  .legal-list li {
    padding: 11px 13px 11px 35px;
  }

  .legal-list li::before {
    top: 17px;
    left: 15px;
  }

  .sdk-card {
    padding: 17px;
  }

  .legal-footer__inner {
    min-height: 150px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
  }

  .legal-footer nav {
    justify-content: flex-start;
  }

  .back-to-top {
    right: 14px;
    bottom: 14px;
    width: 40px;
    height: 40px;
  }
}

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

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

@media print {
  body {
    background: #fff;
  }

  .legal-header,
  .legal-toc,
  .legal-footer,
  .back-to-top {
    display: none;
  }

  .legal-hero {
    color: #111;
    background: #fff;
  }

  .legal-hero__inner {
    padding: 20px 0;
  }

  .legal-eyebrow,
  .legal-meta {
    color: #555;
  }

  .legal-layout {
    display: block;
    padding: 0;
  }

  .legal-document {
    border: 0;
    box-shadow: none;
  }

  .legal-prose {
    padding: 0;
  }

  .legal-prose section {
    break-inside: avoid;
  }
}
