:root {
  --legal-ink: #171719;
  --legal-muted: #626268;
  --legal-line: #dededb;
  --legal-paper: #ffffff;
  --legal-soft: #f4f5f1;
  --legal-accent: #c8f135;
}

.legal-page {
  min-height: 100vh;
  margin: 0;
  color: var(--legal-ink);
  background: #f7f7f4;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.legal-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px max(20px, calc((100vw - 920px) / 2));
  border-bottom: 1px solid rgba(23, 23, 25, .09);
  background: rgba(247, 247, 244, .92);
  backdrop-filter: blur(18px);
}

.legal-header img { width: auto; height: 38px; display: block; }
.legal-back { color: var(--legal-ink); font-size: 13px; font-weight: 750; text-decoration: none; }

.legal-main { width: min(calc(100% - 32px), 920px); margin: 0 auto; padding: 52px 0 84px; }
.legal-hero { max-width: 720px; margin-bottom: 34px; }
.legal-eyebrow { margin: 0 0 8px; color: #4e4e53; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.legal-main h1 { margin: 0 0 13px; font-size: clamp(34px, 7vw, 58px); line-height: 1.02; letter-spacing: 0; }
.legal-intro { margin: 0; color: var(--legal-muted); font-size: 17px; line-height: 1.65; }
.legal-meta { display: inline-flex; margin-top: 18px; padding: 7px 10px; border: 1px solid var(--legal-line); border-radius: 6px; color: var(--legal-muted); background: #fff; font-size: 11px; font-weight: 700; }

.legal-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 42px; align-items: start; }
.legal-toc { position: sticky; top: 92px; display: grid; gap: 4px; }
.legal-toc a { padding: 8px 10px; border-radius: 6px; color: var(--legal-muted); font-size: 12px; font-weight: 650; text-decoration: none; }
.legal-toc a:hover { color: var(--legal-ink); background: #fff; }

.legal-content { min-width: 0; }
.legal-section { padding: 0 0 32px; margin: 0 0 32px; border-bottom: 1px solid var(--legal-line); scroll-margin-top: 100px; }
.legal-section:last-child { border-bottom: 0; }
.legal-section h2 { margin: 0 0 14px; font-size: 23px; line-height: 1.2; letter-spacing: 0; }
.legal-section h3 { margin: 22px 0 8px; font-size: 15px; letter-spacing: 0; }
.legal-section p, .legal-section li { color: #3d3d42; font-size: 14px; line-height: 1.72; }
.legal-section p { margin: 0 0 12px; }
.legal-section ul, .legal-section ol { padding-left: 22px; margin: 8px 0 14px; }
.legal-section a, .legal-callout a { color: var(--legal-ink); font-weight: 750; text-underline-offset: 3px; }
.legal-definition { display: grid; grid-template-columns: 160px 1fr; gap: 12px 20px; margin: 15px 0; }
.legal-definition dt { color: var(--legal-muted); font-size: 12px; font-weight: 700; }
.legal-definition dd { margin: 0; color: #303034; font-size: 14px; line-height: 1.55; }
.legal-callout { margin: 16px 0; padding: 16px 18px; border-left: 4px solid var(--legal-accent); border-radius: 5px; background: #f0f4df; color: #303426; font-size: 13px; line-height: 1.6; }
.legal-callout strong { display: block; margin-bottom: 3px; }
.legal-warning { border-left-color: #e4a432; background: #fff7e7; color: #503c17; }
.legal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.legal-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 16px; border: 1px solid var(--legal-ink); border-radius: 7px; color: #fff !important; background: var(--legal-ink); font-size: 13px; font-weight: 800; text-decoration: none; }
.legal-button.secondary { color: var(--legal-ink) !important; background: #fff; }
.withdrawal-template { padding: 18px; border: 1px solid var(--legal-line); border-radius: 6px; background: #fff; }

body:has(.legal-site-footer) { flex-wrap: wrap; }
.legal-site-footer { width: min(calc(100% - 32px), 1040px); flex: 0 0 100%; margin: 34px auto 18px; padding: 20px 0; border-top: 1px solid rgba(23, 23, 25, .12); }
.legal-site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; }
.legal-site-footer a { color: #5e5e63; font-size: 11px; font-weight: 650; text-decoration: none; }
.legal-site-footer a:hover { color: #171719; text-decoration: underline; text-underline-offset: 3px; }
.legal-site-footer p { margin: 12px 0 0; color: #828287; font-size: 10px; text-align: center; }

.storage-notice {
  position: fixed;
  z-index: 1000;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  width: min(calc(100% - 28px), 620px);
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  color: #fff;
  background: rgba(23, 23, 25, .96);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .26);
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
}
.storage-notice[hidden] { display: none; }
.storage-notice-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 7px; color: #171719; background: var(--legal-accent); font-size: 16px; font-weight: 900; }
.storage-notice-copy { min-width: 0; }
.storage-notice-copy strong { display: block; margin-bottom: 2px; font-size: 12px; }
.storage-notice-copy span { display: block; color: #cacacd; font-size: 10px; line-height: 1.45; }
.storage-notice-copy a { color: #fff; font-weight: 750; }
.storage-notice button { min-height: 38px; padding: 0 13px; border: 0; border-radius: 6px; color: #171719; background: #fff; font: inherit; font-size: 11px; font-weight: 850; cursor: pointer; }

@media (max-width: 720px) {
  .legal-header { padding-inline: 16px; }
  .legal-main { padding-top: 38px; }
  .legal-layout { display: block; }
  .legal-toc { position: static; grid-template-columns: 1fr 1fr; margin-bottom: 34px; padding: 8px; border: 1px solid var(--legal-line); border-radius: 7px; background: #fff; }
  .legal-main h1 { font-size: 36px; }
  .legal-intro { font-size: 15px; }
  .legal-definition { grid-template-columns: 1fr; gap: 3px; }
  .legal-definition dd { margin-bottom: 10px; }
  .storage-notice { grid-template-columns: 32px minmax(0, 1fr); }
  .storage-notice-icon { width: 32px; height: 32px; }
  .storage-notice button { grid-column: 1 / -1; width: 100%; }
}

@media print {
  .legal-header, .legal-toc, .legal-site-footer, .storage-notice, .legal-actions { display: none !important; }
  .legal-page { background: #fff; }
  .legal-main { width: 100%; padding: 0; }
  .legal-layout { display: block; }
  .legal-section { break-inside: avoid; }
}
