.legal-inline-link {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  color: #a9c7ff;
  font: inherit;
  font-weight: 700;
  line-height: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: color .18s ease, opacity .18s ease;
}
.legal-inline-link:hover { color: #fff; }
.legal-inline-link:focus-visible { outline: 2px solid #8eb6ff; outline-offset: 3px; border-radius: 4px; }

.legal-modal {
  width: min(1080px, calc(100vw - 40px));
  height: min(820px, calc(100dvh - 40px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f7f9ff;
  overflow: visible;
}
.legal-modal::backdrop {
  background: rgba(1, 5, 12, .78);
  backdrop-filter: blur(14px) saturate(.8);
  -webkit-backdrop-filter: blur(14px) saturate(.8);
  animation: legalBackdropIn .2s ease both;
}
.legal-modal[open] .legal-modal-sheet { animation: legalSheetIn .28s cubic-bezier(.2,.75,.2,1) both; }
.legal-modal-sheet {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0,1fr) auto;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 90% -10%, rgba(83,126,255,.16), transparent 32%),
    linear-gradient(180deg, #0d1420 0%, #080d15 100%);
  box-shadow: 0 30px 100px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.03) inset;
}
.legal-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 14px;
}
.legal-modal-heading { min-width: 0; }
.legal-modal-heading > span {
  display: block;
  margin-bottom: 3px;
  color: #7f9ed0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
}
.legal-modal-heading h2 { margin: 0; font-size: clamp(21px,2.4vw,30px); letter-spacing: -.02em; }
.legal-modal-close {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 14px;
  background: rgba(255,255,255,.055);
  color: #eaf0ff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.legal-modal-close:hover { transform: rotate(4deg); background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); }
.legal-modal-tabs {
  display: flex;
  gap: 6px;
  margin: 0 24px 14px;
  padding: 5px;
  width: fit-content;
  max-width: calc(100% - 48px);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
}
.legal-modal-tabs button {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #8090a8;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s ease,color .18s ease,box-shadow .18s ease;
}
.legal-modal-tabs button.is-active {
  background: #f5f8ff;
  color: #101726;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.legal-modal-view {
  position: relative;
  min-height: 0;
  margin: 0 18px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 20px;
  background: #fff;
}
.legal-modal-view iframe { width: 100%; height: 100%; border: 0; background: #fff; display: block; opacity: 0; transition: opacity .2s ease; }
.legal-modal-view iframe.is-loaded { opacity: 1; }
.legal-modal-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #0b111b;
  color: #aebbd0;
  pointer-events: none;
  transition: opacity .2s ease, visibility .2s ease;
}
.legal-modal-loading.is-hidden { opacity: 0; visibility: hidden; }
.legal-modal-loading p { margin: 0; font-size: 13px; font-weight: 700; }
.legal-loader { width: 30px; height: 30px; border: 3px solid rgba(255,255,255,.14); border-top-color: #87aaff; border-radius: 50%; animation: legalSpin .75s linear infinite; }
.legal-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 18px;
}
.legal-modal-footer a { color: #8da6cb; font-size: 13px; font-weight: 700; text-decoration: none; }
.legal-modal-footer a:hover { color: #fff; }
.legal-modal-footer button {
  min-width: 112px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 13px;
  background: rgba(255,255,255,.07);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
body.is-legal-modal-open { overflow: hidden; }
@keyframes legalSpin { to { transform: rotate(360deg); } }
@keyframes legalBackdropIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes legalSheetIn { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }

@media (max-width: 700px) {
  .legal-modal {
    width: 100vw;
    height: 100dvh;
    margin: 0;
  }
  .legal-modal-sheet { border: 0; border-radius: 0; }
  .legal-modal-header { padding: calc(14px + env(safe-area-inset-top)) 16px 12px; }
  .legal-modal-tabs { margin: 0 16px 12px; max-width: calc(100% - 32px); width: calc(100% - 32px); }
  .legal-modal-tabs button { flex: 1; padding: 0 10px; }
  .legal-modal-view { margin: 0 10px; border-radius: 14px; }
  .legal-modal-footer { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
  .legal-modal-footer button { min-width: 96px; }
}
@media (prefers-reduced-motion: reduce) {
  .legal-modal::backdrop, .legal-modal[open] .legal-modal-sheet, .legal-loader { animation: none; }
  .legal-modal-view iframe { transition: none; }
}
