:root {
  --ink: #5a5a5a;
  --muted: #767676;
  --line: #e5e5e5;
  --paper: #ffffff;
  --page: #f5f6f8;
  --accent: #762b92;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--page);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--page);
}

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

strong {
  font-weight: 700;
}

.legal-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  min-height: 56px;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  padding: 0 max(16px, calc((100vw - 760px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(248, 249, 251, 0.96);
  backdrop-filter: blur(16px);
}

.app-close {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--muted);
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
}

.app-title {
  justify-self: center;
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
}

.app-header-spacer {
  width: 32px;
  height: 32px;
}

.legal-layout {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.legal-document {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 8px 24px rgba(90, 90, 90, 0.06);
}

.legal-hero {
  padding: 30px 32px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.legal-hero h1 {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.35;
}

.legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.legal-content {
  padding: 28px 32px 36px;
}

.legal-content h2,
.legal-content h3,
.legal-content h4 {
  scroll-margin-top: 76px;
  font-weight: 400;
}

.legal-content h2 {
  margin: 34px 0 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.45;
}

.legal-content h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.legal-content h3 {
  margin: 24px 0 9px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

.legal-content h4 {
  margin: 20px 0 8px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

.legal-content p,
.legal-content li {
  color: #666666;
  font-size: 15px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.legal-content p {
  margin: 0 0 14px;
}

.legal-content ul {
  margin: 4px 0 18px;
  padding-left: 22px;
}

.legal-content li {
  margin-bottom: 6px;
}

.legal-content a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-content strong {
  color: #4f235e;
  font-size: 1.03em;
  font-weight: 700;
}

.legal-footer {
  padding: 22px 16px 34px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.legal-footer span,
.legal-footer a {
  display: inline-block;
  margin: 0 6px;
}

.legal-footer a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.app-close:focus-visible,
.legal-content a:focus-visible,
.legal-footer a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 560px) {
  .legal-header {
    min-height: 54px;
    grid-template-columns: 42px 1fr 42px;
    padding: 0 12px;
  }

  .app-title {
    font-size: 17px;
  }

  .legal-layout {
    padding: 12px 0 28px;
  }

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

  .legal-hero {
    padding: 24px 20px 22px;
  }

  .legal-hero h1 {
    font-size: 20px;
  }

  .legal-content {
    padding: 22px 20px 30px;
  }

  .legal-content p,
  .legal-content li {
    font-size: 15px;
    line-height: 1.8;
  }

  .legal-content h2 {
    font-size: 18px;
  }
}

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