:root {
  --bg: #f5f9f8;
  --bg-rgb: 245, 249, 248;
  --surface: #ffffff;
  --surface-soft: #edf5f3;
  --text: #1b2623;
  --text-soft: #65716e;
  --text-faint: #8c9794;
  --line: rgba(24, 38, 34, .1);
  --brand: #14b8a6;
  --brand-deep: #0f8278;
  --brand-pale: #dcf6f1;
  --amber-pale: #fff3db;
  --shadow: 0 26px 75px rgba(13, 62, 53, .08);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #101614;
  --bg-rgb: 16, 22, 20;
  --surface: #18211f;
  --surface-soft: #202c29;
  --text: #edf6f3;
  --text-soft: #a7b5b1;
  --text-faint: #74827e;
  --line: rgba(234, 248, 244, .09);
  --brand: #25c9b7;
  --brand-deep: #64dfd2;
  --brand-pale: #173c37;
  --amber-pale: #392f1d;
  --shadow: 0 26px 75px rgba(0, 0, 0, .24);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 104px;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 90% 2%, rgba(20, 184, 166, .11), transparent 24rem),
    var(--bg);
  color: var(--text);
  font: 15px/1.9 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  transition: background-color .3s ease, color .3s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  color: inherit;
  font: inherit;
}

::selection {
  background: rgba(20, 184, 166, .22);
}

.read-progress {
  position: fixed;
  z-index: 200;
  inset: 0 0 auto;
  height: 3px;
  pointer-events: none;
}

.read-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), #6fddce, #ff9176);
  transform: scaleX(0);
  transform-origin: left;
}

.legal-header {
  position: fixed;
  z-index: 100;
  inset: 0 0 auto;
  height: 70px;
  border-bottom: 1px solid var(--line);
  background: rgba(var(--bg-rgb), .82);
  box-shadow: 0 8px 30px rgba(15, 60, 52, .04);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
}

.header-shell {
  width: min(1180px, calc(100% - 48px));
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-inline: auto;
}

.legal-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.legal-brand img {
  width: 38px;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, .6);
  box-shadow: 0 8px 20px rgba(20, 70, 62, .08);
}

.legal-brand span {
  display: grid;
  line-height: 1.05;
}

.legal-brand b {
  font-size: 14px;
}

.legal-brand small {
  margin-top: 4px;
  color: var(--text-faint);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .14em;
}

.header-center {
  display: flex;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(var(--bg-rgb), .5);
}

.header-center a {
  padding: 7px 13px;
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
  transition: background-color .2s ease, color .2s ease;
}

.header-center a:hover,
.header-center a.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 5px 15px rgba(20, 65, 57, .07);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-button,
.toc-button,
.back-top {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease;
}

.theme-button {
  position: relative;
}

.theme-button:hover,
.toc-button:hover,
.back-top:hover {
  border-color: rgba(20, 184, 166, .28);
  transform: translateY(-2px);
}

.theme-button svg,
.toc-button svg,
.back-top svg {
  position: absolute;
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  transition: opacity .22s ease, transform .22s ease;
}

.theme-button .moon {
  opacity: 0;
  transform: rotate(-30deg) scale(.7);
}

html[data-theme="dark"] .theme-button .sun {
  opacity: 0;
  transform: rotate(30deg) scale(.7);
}

html[data-theme="dark"] .theme-button .moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

.home-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 13px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 10px;
  font-weight: 700;
}

.home-link svg {
  width: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.toc-button {
  display: none;
}

.legal-layout {
  width: min(1180px, calc(100% - 48px));
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr);
  align-items: start;
  gap: 48px;
  margin: 0 auto;
  padding: 126px 0 90px;
}

.legal-toc {
  position: sticky;
  top: 98px;
  max-height: calc(100vh - 120px);
  overflow: auto;
  scrollbar-width: none;
}

.legal-toc::-webkit-scrollbar {
  display: none;
}

.toc-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 13px;
  color: var(--text-faint);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .16em;
}

.toc-label::before {
  content: "";
  width: 20px;
  height: 1px;
  background: var(--brand);
}

.legal-toc nav {
  position: relative;
  display: grid;
  gap: 2px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.legal-toc a {
  position: relative;
  padding: 7px 9px;
  border-radius: 9px;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.45;
  transition: background-color .2s ease, color .2s ease, transform .2s ease;
}

.legal-toc a::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -16px;
  width: 3px;
  height: 0;
  border-radius: 4px;
  background: var(--brand);
  transform: translateY(-50%);
  transition: height .2s ease;
}

.legal-toc a:hover {
  color: var(--text);
  transform: translateX(2px);
}

.legal-toc a.active {
  background: var(--brand-pale);
  color: var(--brand-deep);
  font-weight: 700;
}

.legal-toc a.active::before {
  height: 18px;
}

.legal-article {
  position: relative;
  max-width: 830px;
  min-width: 0;
  padding: 52px clamp(30px, 6vw, 72px) 45px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.document-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 6px 10px;
  border: 1px solid rgba(20, 184, 166, .17);
  border-radius: 999px;
  background: var(--brand-pale);
  color: var(--brand-deep);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
}

.document-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, .1);
}

.legal-article h1 {
  margin: 0 0 8px;
  font-size: clamp(34px, 5vw, 50px);
  line-height: 1.18;
  letter-spacing: -.045em;
}

.legal-article .meta {
  margin: 0 0 28px;
  color: var(--text-faint);
  font-size: 11px;
}

.document-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -11px 0 30px;
}

.document-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 10px;
}

.document-actions button:hover {
  border-color: rgba(20, 184, 166, .24);
  color: var(--brand-deep);
}

.document-actions svg {
  width: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.legal-article .lead {
  position: relative;
  margin: 0 0 44px;
  padding: 21px 23px;
  overflow: hidden;
  border: 1px solid rgba(20, 184, 166, .17);
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand-pale), var(--surface-soft));
}

.legal-article .lead::before {
  content: "";
  position: absolute;
  top: -50px;
  right: -50px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(20, 184, 166, .08);
}

.legal-article .lead p {
  position: relative;
}

.legal-article h2 {
  position: relative;
  margin: 55px 0 17px;
  padding: 0 0 13px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 21px;
  line-height: 1.45;
  letter-spacing: -.02em;
}

.legal-article h2::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 38px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
}

.legal-article h3 {
  margin: 30px 0 9px;
  color: var(--text);
  font-size: 15px;
}

.legal-article p,
.legal-article li {
  color: var(--text-soft);
}

.legal-article p {
  margin: 11px 0;
}

.legal-article ol,
.legal-article ul {
  padding-left: 23px;
}

.legal-article li {
  margin: 9px 0;
  padding-left: 3px;
}

.legal-article li::marker {
  color: var(--brand-deep);
  font-weight: 700;
}

.legal-article strong {
  color: var(--text);
  font-weight: 700;
}

.legal-article .fill {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--amber-pale);
}

.legal-article table {
  width: 100%;
  margin: 20px 0 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-spacing: 0;
  border-collapse: separate;
  border-radius: 14px;
  font-size: 12px;
  line-height: 1.65;
}

.legal-article th,
.legal-article td {
  padding: 12px 13px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.legal-article th {
  background: var(--brand-pale);
  color: var(--text);
  font-weight: 700;
}

.legal-article td {
  color: var(--text-soft);
}

.legal-article tr:last-child td {
  border-bottom: 0;
}

.legal-article th:last-child,
.legal-article td:last-child {
  border-right: 0;
}

.legal-article footer {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--text-faint);
  font-size: 10px;
  text-align: center;
}

.back-top {
  position: fixed;
  z-index: 70;
  right: 24px;
  bottom: 24px;
  box-shadow: 0 10px 28px rgba(20, 63, 56, .12);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .25s ease, transform .25s ease, border-color .2s ease;
}

.back-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.copy-toast {
  position: fixed;
  z-index: 300;
  left: 50%;
  bottom: 28px;
  padding: 9px 14px;
  border-radius: 999px;
  background: #17312c;
  color: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .2);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity .2s ease, transform .2s ease;
}

.copy-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 920px) {
  .legal-layout {
    grid-template-columns: 1fr;
  }
  .legal-toc {
    display: none;
  }
  .toc-button {
    display: grid;
  }
  .mobile-toc {
    position: fixed;
    z-index: 120;
    top: 78px;
    right: 18px;
    left: 18px;
    max-height: calc(100vh - 100px);
    display: grid;
    gap: 2px;
    padding: 14px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(var(--bg-rgb), .97);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    transition: opacity .22s ease, transform .22s ease;
  }
  .mobile-toc.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
  .mobile-toc a {
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-soft);
    font-size: 11px;
  }
  .mobile-toc a.active {
    background: var(--brand-pale);
    color: var(--brand-deep);
    font-weight: 700;
  }
}

@media (max-width: 680px) {
  .header-shell,
  .legal-layout {
    width: min(100% - 28px, 560px);
  }
  .header-center {
    display: none;
  }
  .home-link {
    width: 38px;
    height: 38px;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
  }
  .home-link span {
    display: none;
  }
  .legal-layout {
    padding-top: 99px;
  }
  .legal-article {
    padding: 35px 21px;
    border-radius: 23px;
  }
  .legal-article h1 {
    font-size: 36px;
  }
  .legal-article .lead {
    padding: 18px;
  }
  .legal-article h2 {
    margin-top: 45px;
    font-size: 18px;
  }
  .legal-article table {
    display: block;
    overflow-x: auto;
    white-space: normal;
  }
  .legal-article th,
  .legal-article td {
    min-width: 130px;
  }
  .back-top {
    right: 16px;
    bottom: 16px;
  }
}

@media print {
  body {
    background: #fff;
  }
  .legal-header,
  .legal-toc,
  .read-progress,
  .document-actions,
  .back-top,
  .copy-toast {
    display: none !important;
  }
  .legal-layout {
    display: block;
    width: auto;
    padding: 0;
  }
  .legal-article {
    max-width: none;
    padding: 0;
    border: 0;
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
