:root {
    color-scheme: light;
    --page: #f5f5f7;
    --surface: #ffffff;
    --surface-soft: #fbfbfd;
    --text: #1d1d1f;
    --muted: #6e6e73;
    --line: #d2d2d7;
    --line-soft: #e8e8ed;
    --blue: #007aff;
    --blue-hover: #0066d6;
    --focus: rgba(0, 122, 255, 0.2);
    --warning-bg: #fff9e8;
    --warning-line: #ead59a;
    --warning-text: #5d4912;
    --radius: 22px;
    --max-width: 1120px;
    --reading-width: 760px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 88px;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--page);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--blue);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover {
    color: var(--blue-hover);
}

a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(245, 245, 247, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
}

.header-inner {
    width: min(calc(100% - 32px), var(--max-width));
    min-height: 64px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
}

.back-link {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-height: 44px;
    color: var(--blue);
    font-size: 17px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.back-link svg {
    width: 19px;
    height: 19px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.back-link:hover svg {
    transform: translateX(-2px);
}

.back-link svg {
    transition: transform 160ms ease;
}

.brand-link {
    justify-self: center;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.brand-logo {
    display: block;
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.header-spacer {
    min-width: 1px;
}

.page-shell {
    width: min(calc(100% - 32px), var(--max-width));
    margin: 34px auto 56px;
}

.document-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: clip;
}

.document-hero {
    padding: 48px 52px 38px;
    border-bottom: 1px solid var(--line-soft);
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--blue);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    color: var(--text);
    letter-spacing: -0.02em;
}

h1 {
    margin: 0;
    max-width: 760px;
    font-size: clamp(2.2rem, 6vw, 4.15rem);
    line-height: 1.04;
    font-weight: 760;
}

.updated {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.document-layout {
    display: grid;
    grid-template-columns: 238px minmax(0, 1fr);
    align-items: start;
}

.toc {
    position: sticky;
    top: 86px;
    max-height: calc(100vh - 108px);
    overflow: auto;
    padding: 34px 24px 34px 32px;
    border-right: 1px solid var(--line-soft);
    scrollbar-width: thin;
}

.toc-title {
    margin: 0 0 13px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.toc a {
    display: block;
    margin: 0 -10px;
    padding: 7px 10px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
    text-decoration: none;
}

.toc a:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.legal-content {
    width: 100%;
    max-width: var(--reading-width);
    padding: 42px 52px 58px;
}

.notice {
    margin: 0 0 36px;
    padding: 16px 18px;
    border: 1px solid var(--warning-line);
    border-radius: 14px;
    background: var(--warning-bg);
    color: var(--warning-text);
    font-size: 14px;
}

.legal-section {
    padding: 0 0 34px;
    scroll-margin-top: 88px;
}

.legal-section + .legal-section {
    padding-top: 34px;
    border-top: 1px solid var(--line-soft);
}

h2 {
    margin: 0 0 14px;
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    line-height: 1.25;
    font-weight: 700;
}

h3 {
    margin: 24px 0 8px;
    font-size: 1.03rem;
    line-height: 1.35;
    font-weight: 700;
}

p {
    margin: 0 0 14px;
    color: #3a3a3c;
}

ul,
ol {
    margin: 10px 0 16px;
    padding-left: 24px;
    color: #3a3a3c;
}

li {
    margin: 7px 0;
}

strong {
    color: var(--text);
}

.definition-list {
    margin: 0;
}

.definition-list dt {
    margin-top: 18px;
    color: var(--text);
    font-weight: 700;
}

.definition-list dd {
    margin: 4px 0 0;
    color: #3a3a3c;
}

.footer {
    width: min(calc(100% - 32px), var(--max-width));
    margin: 0 auto 34px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    color: var(--muted);
    font-size: 13px;
}

.footer p {
    margin: 0;
    color: inherit;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.footer a {
    color: var(--muted);
    text-decoration: none;
}

.footer a:hover {
    color: var(--blue);
}

@media (max-width: 840px) {
    .page-shell {
        margin-top: 22px;
    }

    .document-hero {
        padding: 38px 28px 30px;
    }

    .document-layout {
        display: block;
    }

    .toc {
        position: static;
        display: flex;
        max-height: none;
        gap: 6px;
        overflow-x: auto;
        padding: 14px 18px;
        border-right: 0;
        border-bottom: 1px solid var(--line-soft);
        scrollbar-width: none;
    }

    .toc::-webkit-scrollbar {
        display: none;
    }

    .toc-title {
        display: none;
    }

    .toc a {
        flex: 0 0 auto;
        margin: 0;
        padding: 8px 11px;
        border: 1px solid var(--line-soft);
        border-radius: 999px;
        background: var(--surface);
        white-space: nowrap;
    }

    .legal-content {
        max-width: none;
        padding: 34px 28px 44px;
    }
}

@media (max-width: 520px) {
    .header-inner,
    .page-shell,
    .footer {
        width: min(calc(100% - 20px), var(--max-width));
    }

    .header-inner {
        min-height: 58px;
    }

    .brand-logo {
        width: 36px;
        height: 36px;
    }

    .back-link {
        font-size: 16px;
    }

    .page-shell {
        margin: 12px auto 30px;
    }

    .document-card {
        border-radius: 16px;
    }

    .document-hero {
        padding: 30px 20px 25px;
    }

    .legal-content {
        padding: 28px 20px 34px;
    }

    .legal-section {
        padding-bottom: 28px;
    }

    .legal-section + .legal-section {
        padding-top: 28px;
    }

    .footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media print {
    .site-header,
    .toc,
    .footer {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .page-shell {
        width: 100%;
        margin: 0;
    }

    .document-card {
        border: 0;
        border-radius: 0;
    }

    .document-hero,
    .legal-content {
        max-width: none;
        padding-left: 0;
        padding-right: 0;
    }

    .legal-section {
        break-inside: avoid-page;
    }
}