

/* Backdrop covers the viewport. Centered card on desktop, full-
   screen sheet on mobile. The modal's onclick stops propagation so a
   click on the card doesn't close. */
.legal-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  overscroll-behavior: contain;
}

.legal-modal-shell {
  background: var(--bg);
  border-radius: var(--radius-md);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22), 0 4px 16px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 640px;
  max-height: 80dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Header ─────────────────────────────────────────────────────── */

.legal-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--rule-soft);
  flex-shrink: 0;
}
.legal-modal-version {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.legal-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
  margin-left: auto;
}
.legal-modal-close:hover { background: var(--rule-soft); color: var(--ink); }
.legal-modal-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ─── Body ──────────────────────────────────────────────────────── */

.legal-modal-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.25rem 1.5rem 1.5rem;
}
.legal-modal-loading,
.legal-modal-error {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--ink-soft);
  padding: 1rem 0;
}
.legal-modal-error { color: #b00020; }

.legal-modal-body {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--ink);
}
.legal-modal-body h1 { font-size: 1.5rem; margin: 0 0 0.875rem; letter-spacing: -0.015em; }
.legal-modal-body h2 { font-size: 1.125rem; margin: 1.5rem 0 0.5rem; }
.legal-modal-body p  { margin: 0 0 0.875rem; }
.legal-modal-body ul, .legal-modal-body ol { margin: 0 0 1rem; padding-left: 1.25rem; }
.legal-modal-body li { margin: 0.25rem 0; }
.legal-modal-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.legal-modal-body em { font-style: italic; }
.legal-modal-body strong { font-weight: var(--font-semibold); }

/* ─── Sha256 footer ─────────────────────────────────────────────── */

.legal-modal-foot {
  flex-shrink: 0;
  padding: 0.625rem 1rem;
  border-top: 1px solid var(--rule-soft);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.6875rem;
  color: var(--ink-dim);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow-x: auto;
}
.legal-modal-hash-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.legal-modal-hash {
  font-family: var(--font-mono);
  color: var(--ink-soft);
  background: var(--bg-soft);
  padding: 1px 6px;
  border-radius: 3px;
}

/* ─── Mobile: full-screen sheet ─────────────────────────────────── */

@media (max-width: 640px) {
  .legal-modal-backdrop {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }
  .legal-modal-shell {
    max-width: none;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
  }
}
