:root {
  --legal-bg: #0d1425;
  --legal-surface: rgba(22, 31, 54, .84);
  --legal-surface-strong: #151e34;
  --legal-text: #edf2ff;
  --legal-muted: #a9b6cf;
  --legal-soft: #7f8da9;
  --legal-line: rgba(192, 204, 243, .14);
  --legal-violet: #9699ff;
  --legal-cyan: #77cee3;
  --legal-green: #6bd5a0;
  --legal-shadow: 0 28px 80px rgba(0, 3, 16, .34);
  --legal-radius: 24px;
  --legal-ease: cubic-bezier(.22, .78, .22, 1);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--legal-text);
  background:
    radial-gradient(circle at 10% 2%, rgba(95, 83, 211, .28), transparent 26%),
    radial-gradient(circle at 91% 13%, rgba(47, 151, 184, .2), transparent 23%),
    linear-gradient(180deg, #11182b 0%, var(--legal-bg) 48%, #090f1c 100%);
  font-family: "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .42;
  background-image:
    linear-gradient(rgba(157, 171, 226, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(157, 171, 226, .035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, #000, transparent 64%);
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }

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

.legal-header {
  position: sticky;
  z-index: 20;
  top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1260px, calc(100% - 40px));
  min-height: 72px;
  margin: 16px auto 0;
  padding: 12px 18px;
  border: 1px solid var(--legal-line);
  border-radius: 18px;
  background: rgba(15, 23, 41, .82);
  box-shadow: 0 18px 55px rgba(2, 5, 18, .32), inset 0 1px 0 rgba(255,255,255,.055);
  backdrop-filter: blur(22px) saturate(1.25);
}

.legal-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.legal-brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border: 1px solid rgba(211, 216, 255, .2);
  border-radius: 12px;
  background: linear-gradient(145deg, #817cfb, #5054d5 68%, #4249b1);
  box-shadow: 0 9px 24px rgba(70, 72, 191, .3), inset 0 1px 0 rgba(255,255,255,.38);
  color: white;
  font-family: Georgia, serif;
  font-size: 27px;
  font-style: italic;
}

.legal-brand strong,
.legal-brand small { display: block; }
.legal-brand strong { font-size: 14px; line-height: 1.15; }
.legal-brand small { margin-top: 4px; color: #98a5bf; font-size: 8px; letter-spacing: .15em; }

.legal-header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.legal-back,
.legal-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--legal-line);
  border-radius: 999px;
  background: rgba(255,255,255,.055);
  color: #cbd4e6;
  font-size: 9px;
  font-weight: 700;
  transition: border-color .2s ease, background .2s ease, transform .2s var(--legal-ease);
}

.legal-back { padding: 9px 14px; }
.legal-theme-toggle { gap: 7px; min-width: 74px; padding: 6px 10px 6px 7px; cursor: pointer; }
.legal-theme-toggle > span { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: rgba(142,146,255,.2); color: #c8caff; font-size: 12px; }
.legal-back:hover,
.legal-theme-toggle:hover { border-color: rgba(156,160,255,.34); background: rgba(132,136,255,.12); transform: translateY(-1px); }
.legal-back:focus-visible,
.legal-theme-toggle:focus-visible,
.legal-toc a:focus-visible,
.legal-inline-link:focus-visible { outline: 3px solid rgba(142,146,255,.24); outline-offset: 3px; }

.legal-main { padding-bottom: 100px; }

.legal-hero {
  position: relative;
  overflow: hidden;
  margin-top: 38px;
  padding: 82px clamp(26px, 6vw, 78px) 72px;
  border: 1px solid var(--legal-line);
  border-radius: 34px;
  background:
    radial-gradient(circle at 82% 22%, rgba(101, 112, 238, .22), transparent 24%),
    radial-gradient(circle at 18% 100%, rgba(73, 188, 170, .12), transparent 30%),
    linear-gradient(145deg, rgba(28, 38, 67, .94), rgba(17, 26, 47, .88));
  box-shadow: var(--legal-shadow), inset 0 1px 0 rgba(255,255,255,.065);
}

.legal-hero::after {
  content: "§";
  position: absolute;
  right: 6%;
  top: 2%;
  color: rgba(218, 223, 255, .04);
  font-family: Georgia, serif;
  font-size: clamp(180px, 22vw, 300px);
  line-height: 1;
  transform: rotate(7deg);
}

.legal-kicker,
.legal-section-number {
  color: var(--legal-violet);
  font-family: "Avenir Next", "SF Pro Display", system-ui, sans-serif;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .15em;
}

.legal-hero h1 {
  position: relative;
  z-index: 1;
  margin: 22px 0 20px;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(48px, 6vw, 76px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: .01em;
}

.legal-hero > p {
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin: 0;
  color: #bec9de;
  font-size: 15px;
  line-height: 1.9;
}

.legal-meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 30px;
}

.legal-meta span {
  padding: 8px 11px;
  border: 1px solid rgba(197,207,245,.13);
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  color: #9caac4;
  font-size: 8px;
  font-weight: 700;
}

.legal-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 38px;
  align-items: start;
  margin-top: 38px;
}

.legal-toc {
  position: sticky;
  top: 105px;
  padding: 22px;
  border: 1px solid var(--legal-line);
  border-radius: 20px;
  background: rgba(18, 27, 48, .72);
  box-shadow: 0 18px 48px rgba(0,3,16,.18), inset 0 1px 0 rgba(255,255,255,.04);
  backdrop-filter: blur(18px);
}

.legal-toc > span {
  display: block;
  margin-bottom: 14px;
  color: #dce3f3;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
}

.legal-toc nav { display: grid; gap: 3px; }
.legal-toc a { padding: 8px 9px; border-radius: 8px; color: #8896b0; font-size: 10px; line-height: 1.45; transition: color .2s ease, background .2s ease; }
.legal-toc a:hover { background: rgba(129,133,240,.09); color: #dce3f3; }

.legal-document {
  min-width: 0;
  padding: clamp(28px, 5vw, 58px);
  border: 1px solid var(--legal-line);
  border-radius: var(--legal-radius);
  background: linear-gradient(160deg, rgba(23, 33, 57, .94), rgba(14, 23, 42, .94));
  box-shadow: var(--legal-shadow), inset 0 1px 0 rgba(255,255,255,.045);
}

.legal-summary {
  margin-bottom: 48px;
  padding: 24px;
  border: 1px solid rgba(104, 211, 161, .17);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(37, 98, 76, .22), rgba(50, 74, 113, .16));
}

.legal-summary strong { display: block; margin-bottom: 10px; color: #dff6e9; font-size: 13px; }
.legal-summary p { margin: 0; color: #b9d5c7; font-size: 12px; line-height: 1.85; }

.legal-section {
  scroll-margin-top: 115px;
  padding: 0 0 38px;
}

.legal-section + .legal-section {
  padding-top: 38px;
  border-top: 1px solid var(--legal-line);
}

.legal-section:last-child { padding-bottom: 0; }
.legal-section h2 { margin: 10px 0 17px; color: #f1f4fc; font-size: 23px; line-height: 1.35; letter-spacing: -.025em; }
.legal-section h3 { margin: 24px 0 10px; color: #dfe5f3; font-size: 14px; }
.legal-section p,
.legal-section li { color: var(--legal-muted); font-size: 12px; line-height: 1.95; }
.legal-section p { margin: 0 0 13px; }
.legal-section ul,
.legal-section ol { margin: 12px 0 0; padding-left: 1.4em; }
.legal-section li + li { margin-top: 8px; }
.legal-section strong { color: #e9edf8; font-weight: 700; }
.legal-inline-link { color: #b4b7ff; text-decoration: underline; text-decoration-color: rgba(180,183,255,.35); text-underline-offset: 3px; }

.legal-note {
  margin-top: 20px;
  padding: 16px 18px;
  border-left: 3px solid var(--legal-cyan);
  border-radius: 0 12px 12px 0;
  background: rgba(92, 184, 211, .08);
}
.legal-note p { margin: 0; color: #bdd5df; }

.legal-footer {
  border-top: 1px solid var(--legal-line);
  background: rgba(5, 10, 20, .58);
}

.legal-footer-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 30px;
  min-height: 120px;
  padding-block: 28px;
}

.legal-footer p { margin: 0; color: #76849f; font-size: 9px; line-height: 1.7; }
.legal-footer nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 20px; }
.legal-footer a { color: #9aa8c0; font-size: 9px; font-weight: 650; }
.legal-footer a:hover { color: #e6ebf7; }

html[data-theme="light"] {
  color-scheme: light;
  --legal-bg: #f4f6fd;
  --legal-surface: rgba(255,255,255,.84);
  --legal-surface-strong: #fff;
  --legal-text: #1d263c;
  --legal-muted: #526079;
  --legal-soft: #73809a;
  --legal-line: rgba(50, 61, 103, .14);
  --legal-shadow: 0 28px 75px rgba(42, 52, 93, .13);
}

html[data-theme="light"] body {
  background:
    radial-gradient(circle at 10% 2%, rgba(171, 161, 255, .3), transparent 26%),
    radial-gradient(circle at 91% 13%, rgba(89, 201, 224, .2), transparent 23%),
    linear-gradient(180deg, #fafbff 0%, #f2f4fb 52%, #f9faff 100%);
}

html[data-theme="light"] .legal-header { background: rgba(255,255,255,.84); box-shadow: 0 18px 50px rgba(38,46,83,.12), inset 0 1px 0 #fff; }
html[data-theme="light"] .legal-brand strong { color: #1f2940; }
html[data-theme="light"] .legal-brand small { color: #65738c; }
html[data-theme="light"] .legal-back,
html[data-theme="light"] .legal-theme-toggle { background: #f0efff; color: #4a4db9; }
html[data-theme="light"] .legal-hero { background: radial-gradient(circle at 82% 22%, rgba(109,113,230,.18), transparent 24%), linear-gradient(145deg, rgba(255,255,255,.95), rgba(239,242,255,.92)); }
html[data-theme="light"] .legal-hero > p { color: #53617a; }
html[data-theme="light"] .legal-meta span { background: rgba(255,255,255,.76); color: #66738b; }
html[data-theme="light"] .legal-toc { background: rgba(255,255,255,.78); }
html[data-theme="light"] .legal-toc > span { color: #28334b; }
html[data-theme="light"] .legal-toc a { color: #65728a; }
html[data-theme="light"] .legal-toc a:hover { color: #4146b5; }
html[data-theme="light"] .legal-document { background: linear-gradient(160deg, rgba(255,255,255,.98), rgba(246,248,255,.98)); }
html[data-theme="light"] .legal-summary { background: linear-gradient(135deg, rgba(221,247,234,.9), rgba(235,242,255,.9)); }
html[data-theme="light"] .legal-summary strong { color: #246746; }
html[data-theme="light"] .legal-summary p { color: #456b59; }
html[data-theme="light"] .legal-section h2 { color: #202a41; }
html[data-theme="light"] .legal-section h3,
html[data-theme="light"] .legal-section strong { color: #303b54; }
html[data-theme="light"] .legal-note { background: rgba(81, 174, 202, .09); }
html[data-theme="light"] .legal-note p { color: #446978; }
html[data-theme="light"] .legal-footer { background: rgba(239,242,250,.82); }
html[data-theme="light"] .legal-footer a { color: #56647d; }

@media (max-width: 900px) {
  .legal-layout { grid-template-columns: 1fr; }
  .legal-toc { position: static; }
  .legal-toc nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .legal-shell { width: calc(100% - 28px); }
  .legal-header { top: 8px; width: calc(100% - 20px); min-height: 64px; margin-top: 10px; padding: 9px 10px; }
  .legal-brand-mark { width: 38px; height: 38px; }
  .legal-brand small,
  .legal-back { display: none; }
  .legal-theme-toggle { min-width: 40px; padding: 6px; }
  .legal-theme-toggle small { display: none; }
  .legal-hero { margin-top: 24px; padding: 54px 24px 48px; border-radius: 25px; }
  .legal-hero h1 { font-size: 43px; }
  .legal-hero > p { font-size: 13px; line-height: 1.82; }
  .legal-layout { gap: 18px; margin-top: 18px; }
  .legal-toc { padding: 18px; }
  .legal-toc nav { grid-template-columns: 1fr 1fr; }
  .legal-toc a { min-height: 36px; padding: 9px 7px; }
  .legal-document { padding: 24px 20px; border-radius: 20px; }
  .legal-summary { margin-bottom: 38px; padding: 19px; }
  .legal-section { padding-bottom: 32px; }
  .legal-section + .legal-section { padding-top: 32px; }
  .legal-section h2 { font-size: 21px; }
  .legal-section p,
  .legal-section li { font-size: 12px; line-height: 1.9; }
  .legal-footer-inner { grid-template-columns: 1fr; gap: 18px; }
  .legal-footer nav { justify-content: flex-start; gap: 14px 18px; }
}

/* English legal copy uses longer headings and navigation labels. */
html[lang="en"] .legal-layout {
  grid-template-columns: minmax(220px, 250px) minmax(0, 1fr);
}

html[lang="en"] .legal-hero h1,
html[lang="en"] .legal-section h2 {
  text-wrap: balance;
}

html[lang="en"] .legal-toc a {
  padding-block: 9px;
  font-size: 10.5px;
}

html[lang="en"] .legal-section p,
html[lang="en"] .legal-section li {
  hyphens: auto;
}

@media (max-width: 900px) {
  html[lang="en"] .legal-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  html[lang="en"] .legal-toc nav {
    grid-template-columns: 1fr 1fr;
    column-gap: 12px;
  }

  html[lang="en"] .legal-toc a {
    min-height: 42px;
    font-size: 9.5px;
  }

  html[lang="en"] .legal-hero h1 {
    font-size: clamp(38px, 12vw, 48px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* Balanced legal-page heading scale. */
html[lang="en"] .legal-hero h1 {
  font-size: clamp(42px, 4.7vw, 58px);
  line-height: 1.05;
  letter-spacing: -.04em;
}

html[lang="en"] .legal-section h2 {
  font-size: clamp(20px, 1.8vw, 23px);
}

@media (max-width: 600px) {
  html[lang="en"] .legal-hero h1 {
    font-size: clamp(34px, 10.2vw, 40px);
  }

  html[lang="en"] .legal-section h2 {
    font-size: 20px;
  }
}
