:root {
    color-scheme: dark;
    --legal-bg: #080609;
    --legal-surface: #110d13;
    --legal-border: rgba(255, 255, 255, .1);
    --legal-text: #f5f1f6;
    --legal-muted: #b2aab5;
    --legal-accent: #ca5dff;
    --legal-accent-soft: rgba(202, 93, 255, .13);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--legal-bg);
    color: var(--legal-text);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.legal-page {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(ellipse at 75% -10%, rgba(115, 35, 150, .22), transparent 45%),
        radial-gradient(ellipse at 0% 35%, rgba(96, 25, 45, .16), transparent 32%),
        var(--legal-bg);
    color: var(--legal-text);
    -webkit-font-smoothing: antialiased;
}

.legal-shell { width: min(1080px, calc(100% - 40px)); margin: 0 auto; }

.legal-header {
    display: flex;
    min-height: 82px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid var(--legal-border);
}

.legal-brand { display: inline-flex; align-items: center; gap: 11px; color: var(--legal-text); text-decoration: none; }
.legal-brand img { width: 38px; height: 38px; border: 1px solid rgba(202, 93, 255, .35); border-radius: 12px; }
.legal-brand strong { display: block; font-size: 15px; letter-spacing: -.02em; }
.legal-brand small { display: block; margin-top: 3px; color: var(--legal-muted); font-size: 11px; }

.legal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.legal-nav a {
    padding: 9px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--legal-muted);
    font-size: 13px;
    text-decoration: none;
    transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.legal-nav a:hover, .legal-nav a[aria-current="page"] { border-color: var(--legal-border); background: rgba(255, 255, 255, .045); color: #fff; }

.legal-main { padding: 58px 0 84px; }
.legal-hero {
    position: relative;
    overflow: hidden;
    padding: clamp(25px, 5vw, 48px);
    border: 1px solid rgba(202, 93, 255, .25);
    border-radius: 24px;
    background: linear-gradient(118deg, rgba(48, 20, 58, .8), rgba(19, 13, 22, .96) 62%);
    box-shadow: 0 28px 80px rgba(0, 0, 0, .24);
}
.legal-hero::after { position: absolute; top: -105px; right: -45px; width: 300px; height: 300px; border: 1px solid rgba(202, 93, 255, .12); border-radius: 50%; box-shadow: 0 0 0 32px rgba(202, 93, 255, .035), 0 0 0 68px rgba(202, 93, 255, .025); content: ""; pointer-events: none; }
.legal-eyebrow { display: inline-flex; align-items: center; gap: 9px; color: #d9a7f5; font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.legal-eyebrow::before { width: 7px; height: 7px; border-radius: 50%; background: var(--legal-accent); box-shadow: 0 0 16px var(--legal-accent); content: ""; }
.legal-hero h1 { position: relative; z-index: 1; max-width: 760px; margin: 15px 0 12px; font-size: clamp(34px, 6vw, 58px); letter-spacing: -.055em; line-height: 1.04; }
.legal-hero p { position: relative; z-index: 1; max-width: 730px; margin: 0; color: #c2b8c8; font-size: 16px; line-height: 1.75; }
.legal-updated { position: relative; z-index: 1; display: inline-flex; margin-top: 22px; padding: 8px 11px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 999px; background: rgba(0, 0, 0, .18); color: #d9d1df; font-size: 12px; }

.legal-content { display: grid; grid-template-columns: minmax(0, 1fr) 250px; align-items: start; gap: 20px; margin-top: 22px; }
.legal-article, .legal-toc { border: 1px solid var(--legal-border); border-radius: 20px; background: linear-gradient(145deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .012)), var(--legal-surface); }
.legal-article { min-width: 0; padding: clamp(22px, 4vw, 42px); }
.legal-article section + section { margin-top: 34px; padding-top: 29px; border-top: 1px solid var(--legal-border); }
.legal-article h2 { margin: 0 0 12px; font-size: 20px; letter-spacing: -.025em; line-height: 1.3; }
.legal-article h3 { margin: 21px 0 8px; font-size: 16px; }
.legal-article p, .legal-article li { color: #c5bdca; font-size: 15px; line-height: 1.82; }
.legal-article p { margin: 9px 0; }
.legal-article ul { display: grid; gap: 8px; margin: 12px 0; padding-left: 22px; }
.legal-article li::marker { color: var(--legal-accent); }
.legal-article a { color: #dfaff7; text-decoration: underline; text-decoration-color: rgba(223, 175, 247, .45); text-underline-offset: 3px; }
.legal-article a:hover { color: #fff; }
.legal-note { margin-top: 16px !important; padding: 14px 16px; border: 1px solid rgba(202, 93, 255, .22); border-left: 3px solid var(--legal-accent); border-radius: 12px; background: var(--legal-accent-soft); color: #e5d8ed !important; }
.legal-toc { position: sticky; top: 18px; padding: 18px; }
.legal-toc h2 { margin: 2px 0 12px; font-size: 14px; }
.legal-toc nav { display: grid; gap: 3px; }
.legal-toc a { padding: 8px 9px; border-radius: 8px; color: var(--legal-muted); font-size: 12px; line-height: 1.45; text-decoration: none; }
.legal-toc a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.legal-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 23px 0 36px; border-top: 1px solid var(--legal-border); color: #98909d; font-size: 12px; }
.legal-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.legal-footer a { color: #d9a7f5; text-decoration: none; }
.legal-footer a:hover { color: #fff; text-decoration: underline; }
.legal-header a:focus-visible, .legal-article a:focus-visible, .legal-toc a:focus-visible, .legal-footer a:focus-visible { outline: 2px solid var(--legal-accent); outline-offset: 3px; }

@media (max-width: 820px) {
    .legal-content { grid-template-columns: 1fr; }
    .legal-toc { position: static; grid-row: 1; }
    .legal-toc nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .legal-shell { width: min(calc(100% - 28px), 1080px); }
    .legal-header { min-height: auto; align-items: flex-start; flex-direction: column; gap: 12px; padding: 16px 0; }
    .legal-nav { width: 100%; gap: 3px; }
    .legal-nav a { padding: 8px 9px; font-size: 12px; }
    .legal-main { padding: 28px 0 52px; }
    .legal-hero { border-radius: 18px; }
    .legal-hero p { font-size: 15px; }
    .legal-article { padding: 20px; border-radius: 16px; }
    .legal-article p, .legal-article li { font-size: 14px; }
    .legal-toc { padding: 15px; }
    .legal-footer { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: .01ms !important; }
}
