:root {
  --lp-bg-0: #fcf8ff;
  --lp-bg-1: #efe4ff;
  --lp-bg-2: #dfcffb;
  --lp-text: #22173a;
  --lp-muted: #5f4f82;
  --lp-line: rgba(96, 68, 190, 0.24);
  --lp-line-strong: rgba(96, 68, 190, 0.34);
  --lp-card: rgba(255, 255, 255, 0.78);
  --lp-card-strong: rgba(255, 255, 255, 0.88);
  --lp-chip: rgba(127, 89, 239, 0.13);
  --lp-chip-line: rgba(127, 89, 239, 0.34);
  --lp-accent: #7f59ef;
  --lp-accent-2: #a88cff;
  --lp-shadow-soft: 0 18px 42px rgba(86, 56, 173, 0.16);
  --lp-shadow-card: 0 16px 34px rgba(91, 61, 171, 0.12);
}

html[data-theme="dark"] body.legal-page,
body.legal-page.dark-mode,
body.legal-page[data-theme="dark"] {
  --lp-bg-0: #0f0b1d;
  --lp-bg-1: #17102b;
  --lp-bg-2: #22163c;
  --lp-text: #f2ecff;
  --lp-muted: #c4b9e8;
  --lp-line: rgba(167, 142, 255, 0.3);
  --lp-line-strong: rgba(173, 148, 255, 0.44);
  --lp-card: rgba(33, 24, 58, 0.74);
  --lp-card-strong: rgba(29, 21, 51, 0.82);
  --lp-chip: rgba(156, 128, 255, 0.2);
  --lp-chip-line: rgba(176, 152, 255, 0.42);
  --lp-shadow-soft: 0 22px 56px rgba(5, 3, 16, 0.55);
  --lp-shadow-card: 0 18px 42px rgba(7, 4, 18, 0.52);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body.legal-page {
  min-height: 100svh;
  font-family: "Manrope", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--lp-text);
  background:
    radial-gradient(980px 560px at 12% -10%, rgba(152, 112, 246, 0.32), transparent 64%),
    radial-gradient(860px 460px at 88% -6%, rgba(116, 82, 243, 0.28), transparent 62%),
    linear-gradient(162deg, var(--lp-bg-0) 0%, var(--lp-bg-1) 48%, var(--lp-bg-2) 100%);
  background-attachment: fixed, fixed, fixed;
  overflow-x: hidden;
}

body.legal-page::before,
body.legal-page::after {
  content: "";
  position: fixed;
  border-radius: 999px;
  filter: blur(42px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.56;
}

body.legal-page::before {
  width: 340px;
  height: 340px;
  left: -110px;
  top: 18vh;
  background: rgba(148, 186, 255, 0.24);
}

body.legal-page::after {
  width: 420px;
  height: 420px;
  right: -140px;
  top: 42vh;
  background: rgba(209, 164, 255, 0.2);
}

.legal-wrap {
  position: relative;
  z-index: 1;
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.2rem 0 2.4rem;
}

.legal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}

.legal-back {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  color: var(--lp-muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  transition: background 180ms ease, color 180ms ease;
}

.legal-back:hover {
  background: rgba(127, 89, 239, 0.12);
  color: #4f3a8f;
}

body.legal-page.dark-mode .legal-back:hover,
body.legal-page[data-theme="dark"] .legal-back:hover {
  color: #e7dcff;
}

.legal-logo {
  height: 34px;
  width: auto;
}

.legal-surface {
  border: 1px solid var(--lp-line-strong);
  border-radius: 24px;
  background: var(--lp-card);
  box-shadow: var(--lp-shadow-soft);
  backdrop-filter: saturate(1.2) blur(12px);
  -webkit-backdrop-filter: saturate(1.2) blur(12px);
  padding: 1.2rem 1.15rem;
}

.legal-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  border: 1px solid var(--lp-chip-line);
  background: var(--lp-chip);
  border-radius: 999px;
  padding: 0.24rem 0.72rem;
  color: #6444bc;
  font-size: 0.82rem;
  font-weight: 700;
}

body.legal-page.dark-mode .legal-kicker,
body.legal-page[data-theme="dark"] .legal-kicker {
  color: #e2d7ff;
}

.legal-kicker::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #88b6ff;
}

.legal-title {
  margin: 0.72rem 0 0.3rem;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: clamp(1.52rem, 4.2vw, 2.45rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

body.legal-page.dark-mode .legal-title,
body.legal-page[data-theme="dark"] .legal-title {
  color: #f4eeff;
}

.legal-sub {
  margin: 0;
  color: var(--lp-muted);
  line-height: 1.58;
  max-width: 78ch;
}

.legal-meta {
  margin-top: 0.78rem;
  color: var(--lp-muted);
  font-size: 0.84rem;
}

.legal-links {
  margin-top: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.48rem;
}

.legal-pill-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--lp-line);
  background: rgba(255, 255, 255, 0.64);
  color: var(--lp-muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.42rem 0.8rem;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.legal-pill-link.active {
  border-color: rgba(127, 89, 239, 0.5);
  background: rgba(127, 89, 239, 0.14);
  color: #503892;
}

body.legal-page.dark-mode .legal-pill-link,
body.legal-page[data-theme="dark"] .legal-pill-link {
  background: rgba(39, 28, 68, 0.66);
}

body.legal-page.dark-mode .legal-pill-link.active,
body.legal-page[data-theme="dark"] .legal-pill-link.active {
  border-color: rgba(173, 148, 255, 0.66);
  background: rgba(156, 128, 255, 0.24);
  color: #f1e9ff;
}

.legal-grid {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 0.8rem;
}

.legal-nav {
  position: sticky;
  top: 14px;
  align-self: start;
  border: 1px solid var(--lp-line);
  border-radius: 18px;
  background: var(--lp-card-strong);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0.75rem 0.78rem;
}

.legal-nav h2 {
  margin: 0;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 0.93rem;
}

.legal-nav a {
  display: block;
  margin-top: 0.34rem;
  padding: 0.35rem 0.5rem;
  border-radius: 10px;
  color: var(--lp-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  transition: background 160ms ease, color 160ms ease;
}

.legal-nav a:hover {
  background: rgba(127, 89, 239, 0.1);
  color: var(--lp-text);
}

body.legal-page.dark-mode .legal-nav a:hover,
body.legal-page[data-theme="dark"] .legal-nav a:hover {
  background: rgba(156, 128, 255, 0.2);
}

.legal-content {
  border: 1px solid var(--lp-line);
  border-radius: 20px;
  background: var(--lp-card-strong);
  box-shadow: var(--lp-shadow-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 1rem;
  font-size: 0.91rem;
}

.legal-section {
  border-top: 1px solid rgba(96, 68, 190, 0.16);
  padding-top: 0.9rem;
  margin-top: 0.9rem;
}

.legal-section:first-child {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.legal-section h3 {
  margin: 0 0 0.35rem;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: clamp(1.03rem, 2.5vw, 1.3rem);
}

.legal-section p,
.legal-section li {
  color: var(--lp-muted);
  font-size: 0.91rem;
  line-height: 1.58;
}

.legal-section ul {
  margin: 0.28rem 0 0.35rem 1rem;
  padding: 0;
}

.legal-quote {
  border-left: 3px solid #8d6df7;
  border-radius: 10px;
  background: rgba(141, 109, 247, 0.08);
  padding: 0.58rem 0.72rem;
  color: #523a95;
  font-weight: 650;
}

body.legal-page.dark-mode .legal-quote,
body.legal-page[data-theme="dark"] .legal-quote {
  color: #e1d5ff;
  background: rgba(156, 128, 255, 0.14);
}

.legal-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.58rem;
}

.legal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(127, 89, 239, 0.34);
  padding: 0.56rem 0.95rem;
  text-decoration: none;
  font-weight: 700;
  color: #433168;
  background: rgba(255, 255, 255, 0.74);
}

body.legal-page.dark-mode .legal-btn,
body.legal-page[data-theme="dark"] .legal-btn {
  color: #efe8ff;
  background: rgba(44, 32, 74, 0.72);
}

.legal-back:focus-visible,
.legal-pill-link:focus-visible,
.legal-nav a:focus-visible,
.legal-btn:focus-visible,
.legal-card a:focus-visible {
  outline: 2px solid rgba(127, 89, 239, 0.72);
  outline-offset: 2px;
}

.legal-btn.primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(120deg, var(--lp-accent) 0%, var(--lp-accent-2) 100%);
}

.legal-note {
  margin-top: 1rem;
  border: 1px dashed rgba(96, 68, 190, 0.33);
  border-radius: 12px;
  padding: 0.56rem 0.7rem;
  color: var(--lp-muted);
  font-size: 0.8rem;
}

.legal-cards {
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.legal-card {
  border: 1px solid var(--lp-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  padding: 0.9rem;
  box-shadow: 0 10px 26px rgba(95, 64, 181, 0.1);
}

body.legal-page.dark-mode .legal-card,
body.legal-page[data-theme="dark"] .legal-card {
  background: rgba(36, 26, 63, 0.76);
  box-shadow: 0 14px 28px rgba(6, 4, 16, 0.42);
}

.legal-card h3 {
  margin: 0 0 0.38rem;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 1.02rem;
}

.legal-card p {
  margin: 0.2rem 0;
  color: var(--lp-muted);
}

.legal-card a {
  color: #5a3fd8;
  text-decoration: none;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

.legal-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.legal-table th,
.legal-table td {
  border: 1px solid rgba(96, 68, 190, 0.22);
  text-align: left;
  vertical-align: top;
  padding: 0.52rem;
  font-size: 0.82rem;
  color: var(--lp-muted);
}

.legal-table th {
  color: #3f2f68;
  font-family: "Sora", "Manrope", sans-serif;
  background: rgba(127, 89, 239, 0.08);
}

@media (prefers-color-scheme: dark) {
  body.legal-page {
    --lp-bg-0: #0f0b1d;
    --lp-bg-1: #17102b;
    --lp-bg-2: #22163c;
    --lp-text: #f2ecff;
    --lp-muted: #c4b9e8;
    --lp-line: rgba(167, 142, 255, 0.3);
    --lp-line-strong: rgba(173, 148, 255, 0.44);
    --lp-card: rgba(33, 24, 58, 0.74);
    --lp-card-strong: rgba(29, 21, 51, 0.82);
    --lp-chip: rgba(156, 128, 255, 0.2);
    --lp-chip-line: rgba(176, 152, 255, 0.42);
    --lp-shadow-soft: 0 22px 56px rgba(5, 3, 16, 0.55);
    --lp-shadow-card: 0 18px 42px rgba(7, 4, 18, 0.52);
  }

  body.legal-page::before {
    background: rgba(113, 158, 255, 0.18);
  }

  body.legal-page::after {
    background: rgba(173, 118, 255, 0.2);
  }

  .legal-back:hover {
    color: #e7dcff;
  }

  .legal-kicker {
    color: #e2d7ff;
  }

  .legal-title {
    color: #f4eeff;
  }

  .legal-pill-link {
    background: rgba(39, 28, 68, 0.66);
  }

  .legal-pill-link.active {
    border-color: rgba(173, 148, 255, 0.66);
    background: rgba(156, 128, 255, 0.24);
    color: #f1e9ff;
  }

  .legal-nav a:hover {
    background: rgba(156, 128, 255, 0.2);
  }

  .legal-quote {
    color: #e1d5ff;
    background: rgba(156, 128, 255, 0.14);
  }

  .legal-btn {
    color: #efe8ff;
    background: rgba(44, 32, 74, 0.72);
  }

  .legal-card {
    background: rgba(36, 26, 63, 0.76);
    box-shadow: 0 14px 28px rgba(6, 4, 16, 0.42);
  }
}

@media (max-width: 980px) {
  .legal-grid {
    grid-template-columns: 1fr;
  }

  .legal-nav {
    position: static;
  }

  .legal-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .legal-wrap {
    width: min(1100px, calc(100% - 1.4rem));
  }

  .legal-topbar {
    flex-wrap: wrap;
    align-items: center;
    gap: 0.56rem;
    margin-bottom: 0.74rem;
  }

  .legal-logo {
    height: 30px;
  }

  .legal-surface,
  .legal-content {
    border-radius: 16px;
    padding: 0.92rem;
  }

  .legal-pill-link {
    min-height: 38px;
    font-size: 0.78rem;
    padding: 0.36rem 0.72rem;
  }

  .legal-actions {
    gap: 0.5rem;
  }

  .legal-btn {
    width: 100%;
  }
}
