:root {
  /* Match palette and card styling in app/src/components/ui.tsx. */
  --background: #111318;
  --surface: #1c1f27;
  --text: #f4f2f7;
  --muted: #adb0bc;
  --primary: #c4b5fd;
  --divider: #343947;
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--background);
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.9; overflow-wrap: anywhere; }
.site-header, main { width: min(100% - 40px, 760px); margin-inline: auto; }
.site-header { padding-block: 28px; border-bottom: 1px solid #343947; }
.brand { font-weight: 700; font-size: 20px; letter-spacing: .12em; }
main { padding-block: 32px 48px; }
h1 { font-size: clamp(25px, 5vw, 36px); line-height: 1.5; margin: 0 0 16px; }
h2 { font-size: 19px; line-height: 1.6; margin: 0 0 12px; }
section { margin-top: 36px; }
p { margin: 0 0 16px; }
.help-intro { color: #b9bdca; }
.help-categories { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.help a { color: #d4c7ff; text-underline-offset: 4px; }
.help-categories a { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px; background: #20242e; border: 1px solid #343947; border-radius: 12px; text-decoration: none; }
.help section { scroll-margin-top: 20px; }
.help details { border-bottom: 1px solid #343947; }
.help summary { padding: 16px 4px; min-height: 48px; cursor: pointer; font-weight: 600; line-height: 1.7; }
.help details[open] summary { color: #d4c7ff; }
.help details p { padding: 0 4px 8px; color: #d7dae3; white-space: pre-line; }
.help a:focus-visible, .help summary:focus-visible { outline: 2px solid #c4b5fd; outline-offset: 4px; border-radius: 4px; }
.help-contact { background: #20242e; border: 1px solid #343947; border-radius: 16px; padding: 20px; }
.help-contact > a { display: inline-flex; align-items: center; min-height: 44px; }
.help-contact-note { color: #b9bdca; font-size: 14px; margin-top: 12px; margin-bottom: 0; }

.legal-page {
  font-size: 16px;
  line-height: 1.9;
  padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
}

.legal-page .site-header {
  padding-block: max(16px, env(safe-area-inset-top)) 12px;
  border-bottom: 0;
}

.legal-page .brand {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 18px;
  line-height: 1.5;
  letter-spacing: .1em;
}

.brand-mark {
  display: block;
  flex: none;
  object-fit: contain;
}

.legal-page main {
  padding-block: 12px max(64px, env(safe-area-inset-bottom));
}

.document-header {
  padding: 8px 4px 28px;
}

.document-header h1 {
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: .02em;
  margin-bottom: 10px;
}

.document-lead {
  color: var(--muted);
  font-size: 15px;
  margin: 0;
}

.document-sections {
  padding: 28px 32px;
  border: 1px solid var(--divider);
  border-radius: 20px;
  background: var(--surface);
}

.document-section {
  margin: 0;
  padding-block: 28px;
}

.document-section:first-child {
  padding-top: 0;
}

.document-section:last-child {
  padding-bottom: 0;
}

.document-section + .document-section {
  border-top: 1px solid var(--divider);
}

.document-section-heading {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  margin-bottom: 16px;
}

.document-section-heading h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.65;
}

.section-number {
  display: grid;
  place-items: center;
  width: 28px;
  min-height: 28px;
  border-radius: 9px;
  background: rgb(196 181 253 / 10%);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.document-copy p {
  margin: 0;
  line-break: strict;
}

.document-copy p + p {
  margin-top: 12px;
}

.legal-page ::selection {
  background: var(--primary);
  color: var(--background);
}

@media (max-width: 600px) {
  .legal-page .site-header,
  .legal-page main {
    width: calc(100% - 32px);
  }

  .document-header {
    padding-bottom: 24px;
  }

  .document-sections {
    padding: 22px 20px;
  }

  .document-section {
    padding-block: 24px;
  }
}

@media print {
  :root {
    color-scheme: light;
    background: white;
    color: black;
  }

  .legal-page .site-header,
  .legal-page main {
    width: 100%;
  }

  .document-sections {
    padding: 0;
    border: 0;
    background: white;
  }

  .document-lead,
  .section-number {
    color: black;
  }

  .section-number {
    background: transparent;
  }

  .document-section {
    break-inside: avoid;
  }
}
