:root {
    --bg: #050505;
    --primary: #E8EEF5;
    --accent: #FE910E;
    --text: #E0E0E0;
    --surface: #111111;
    --border: #222222;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: clip;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

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

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 max(40px, env(safe-area-inset-right)) 0 max(40px, env(safe-area-inset-left));
}

.legal-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: calc(22px + env(safe-area-inset-top)) max(40px, env(safe-area-inset-right)) 22px max(40px, env(safe-area-inset-left));
    background: rgba(5, 5, 5, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.legal-header.scrolled {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.brand {
    display: flex;
    align-items: center;
    line-height: 0;
}

.brand img {
    display: block;
    height: 40px;
    width: auto;
    max-width: min(280px, 68vw);
    object-fit: contain;
    image-rendering: auto;
}

.legal-back {
    font-family: 'Syne', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.65;
    transition: opacity 0.25s ease, color 0.25s ease;
}

.legal-back:hover {
    opacity: 1;
}

.legal-page {
    flex: 1;
    padding: 72px 0 96px;
}

.legal-container {
    max-width: 760px;
}

.legal-kicker {
    font-family: 'Syne', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 16px;
}

.legal-page h1 {
    font-family: 'Syne', sans-serif;
    font-size: clamp(2rem, 5vw, 3rem);
    text-transform: uppercase;
    line-height: 0.95;
    margin-bottom: 12px;
}

.legal-meta {
    font-size: 0.88rem;
    opacity: 0.5;
    margin-bottom: 32px;
}

.legal-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 48px;
    border: 1px solid var(--border);
}

.legal-tabs a {
    flex: 1 1 auto;
    min-width: 140px;
    padding: 14px 16px;
    font-family: 'Syne', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    border-right: 1px solid var(--border);
    opacity: 0.55;
    transition: background-color 0.25s ease, color 0.25s ease, opacity 0.25s ease;
}

.legal-tabs a:last-child {
    border-right: none;
}

.legal-tabs a:hover {
    opacity: 0.9;
    color: white;
}

.legal-tabs a.is-active {
    background: var(--accent);
    color: #050505;
    opacity: 1;
}

.legal-page section + section {
    margin-top: 8px;
}

.legal-page h2 {
    font-family: 'Syne', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 32px 0 14px;
    line-height: 1.3;
}

.legal-page p {
    font-size: 0.96rem;
    line-height: 1.65;
    opacity: 0.78;
    margin-bottom: 12px;
}

.legal-page p strong {
    color: white;
    opacity: 1;
    font-weight: 600;
}

.legal-page ul {
    margin: 0 0 16px 18px;
    padding: 0;
}

.legal-page li {
    font-size: 0.96rem;
    line-height: 1.65;
    opacity: 0.78;
    margin-bottom: 8px;
}

.legal-page a {
    color: white;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.legal-page a:hover {
    color: var(--primary);
}

code {
    font-family: 'Inter', monospace;
    font-size: 0.9em;
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 6px;
}

.legal-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0 20px;
    font-size: 0.88rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.legal-table thead,
.legal-table tbody {
    display: table;
    width: 100%;
    min-width: 520px;
}

.legal-table th,
.legal-table td {
    border: 1px solid var(--border);
    padding: 12px 14px;
    text-align: left;
    vertical-align: top;
}

.legal-table th {
    font-family: 'Syne', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--surface);
    color: white;
}

.legal-table td {
    opacity: 0.78;
}

.legal-footer {
    border-top: 1px solid var(--border);
    padding: 28px 0 36px;
}

.legal-footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.legal-footer-inner p {
    font-size: 0.85rem;
    opacity: 0.45;
}

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

.legal-footer-links a {
    font-family: 'Syne', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.55;
    transition: opacity 0.25s ease, color 0.25s ease;
}

.legal-footer-links a:hover {
    opacity: 1;
    color: var(--primary);
}

@media (max-width: 900px) {
    .container,
    .legal-header {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }

    .legal-header {
        padding-top: calc(16px + env(safe-area-inset-top));
        padding-bottom: 16px;
        gap: 12px;
    }

    .brand img {
        height: 32px;
        max-width: min(220px, 55vw);
    }

    .legal-page {
        padding: 56px 0 72px;
    }

    .legal-page h1 {
        font-size: clamp(1.8rem, 8vw, 2.4rem);
    }
}

@media (max-width: 700px) {
    .container,
    .legal-header {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .legal-tabs a {
        min-width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .legal-tabs a:last-child {
        border-bottom: none;
    }

    .legal-table {
        font-size: 0.8rem;
    }

    .legal-table th,
    .legal-table td {
        padding: 10px 10px;
    }

    .legal-footer {
        padding-bottom: max(28px, env(safe-area-inset-bottom));
    }
}

@media (max-width: 360px) {
    .brand img {
        height: 24px;
        max-width: min(160px, 48vw);
    }

    .legal-back {
        font-size: 0.65rem;
    }

    .legal-page h1 {
        font-size: clamp(1.55rem, 9vw, 1.9rem);
    }
}
