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

:root {
    --bg-primary: var(--color-bg-base, #0A0A0B);
    --bg-secondary: var(--color-bg-surface, #111113);
    --text-primary: #ffffff;
    --text-secondary: #a0a0a8;
    --text-muted: #6b6b75;
    --border-subtle: rgba(255, 255, 255, 0.1);
    --green-primary: var(--color-brand-primary, #3AAFD4);
    --purple-primary: var(--color-brand-secondary, #3AAFD4);
    --logo-filter: brightness(0) invert(1);
}

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

#legalBackgroundCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.legal-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 10, 11, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: background 0.3s ease;
}

.legal-header::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(
        to bottom,
        rgba(10, 10, 11, 0.85) 0%,
        rgba(10, 10, 11, 0.6) 30%,
        rgba(10, 10, 11, 0.3) 60%,
        transparent 100%
    );
    pointer-events: none;
}

.legal-header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.legal-nav-left {
    display: flex;
    align-items: center;
    gap: 0;
}

.legal-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.legal-logo-img {
    height: 32px;
    width: auto;
    filter: var(--logo-filter);
}

.legal-nav-buttons {
    display: flex;
    gap: 40px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.legal-nav-btn {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 16px;
    font-weight: 400;
    padding: 8px 16px;
    transition: all 0.3s ease;
    position: relative;
}

.legal-nav-btn::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-green));
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.legal-nav-btn:hover {
    color: var(--text-primary);
}

.legal-nav-btn:hover::after {
    width: 100%;
}

.legal-nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.legal-nav-right .home-user-menu {
    position: static;
    z-index: auto;
}

.legal-nav-right .guest-theme-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.legal-nav-right .guest-theme-btn svg {
    width: 18px;
    height: 18px;
}

.legal-nav-right .guest-theme-btn:hover {
    color: #fff;
    background: rgba(58, 175, 212, 0.1);
}

body.light-mode .legal-nav-right .guest-theme-btn {
    background: rgba(0, 0, 0, 0.03);
    color: #3A3A42;
}

body.light-mode .legal-nav-right .guest-theme-btn:hover {
    color: #1A7A9E;
    background: rgba(58, 175, 212, 0.1);
}

.legal-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-brand-primary, #3AAFD4) 0%, var(--color-brand-secondary, #3AAFD4) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease;
    text-decoration: none;
}

.legal-user-avatar:hover {
    transform: scale(1.05);
}

.legal-user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.legal-user-avatar {
    border: none;
    padding: 0;
}

.legal-user-menu {
    position: relative;
}

.legal-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: rgba(26, 26, 30, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 200;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.legal-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.legal-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
}

.legal-dropdown-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-brand-primary, #3AAFD4) 0%, var(--color-brand-secondary, #3AAFD4) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.legal-dropdown-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.legal-dropdown-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.legal-dropdown-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.legal-dropdown-email {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.legal-dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 4px 0;
}

.legal-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.15s ease;
    cursor: pointer;
}

.legal-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.legal-dropdown-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.legal-dropdown-logout:hover {
    color: #F87171;
}

.legal-dropdown-section {
    padding: 4px 0;
}

.legal-dropdown-section-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px 4px;
}

.legal-nav-dropdown-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.legal-nav-dropdown-wrapper:hover .legal-nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.legal-nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 160px;
    background: rgba(26, 26, 30, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 150;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    margin-top: 4px;
}

.legal-nav-dropdown-item {
    display: block;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.legal-nav-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.try-deon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 50px;
    background: transparent;
    border: 1px solid transparent;
    background: 
        linear-gradient(var(--bg-primary), var(--bg-primary)) padding-box,
        linear-gradient(90deg, var(--color-brand-primary, #3AAFD4), var(--color-luminous-cyan, #5ECAF0), var(--color-brand-primary, #3AAFD4)) border-box;
    transition: all 0.3s ease;
}

.try-deon-btn:hover {
    background: 
        linear-gradient(90deg, rgba(58, 175, 212, 0.15), rgba(58, 175, 212, 0.15)) padding-box,
        linear-gradient(90deg, var(--color-brand-primary, #3AAFD4), var(--color-luminous-cyan, #5ECAF0), var(--color-brand-primary, #3AAFD4)) border-box;
    box-shadow: 
        0 0 20px rgba(58, 175, 212, 0.25),
        0 0 40px rgba(58, 175, 212, 0.15);
}

.legal-content {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 120px 60px 200px;
}

.legal-article {
    background: transparent;
    padding: 0;
}

.legal-article h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.legal-company {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.legal-date {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.legal-divider {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 32px 0;
}

.legal-article h2 {
    font-size: 24px;
    font-weight: 600;
    margin-top: 40px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.legal-article h3 {
    font-size: 18px;
    font-weight: 600;
    margin-top: 28px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.legal-article p {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.7;
}

.legal-article ul {
    margin-bottom: 16px;
    padding-left: 24px;
}

.legal-article li {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.6;
}

.legal-article a {
    color: var(--green-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.legal-article a:hover {
    color: #5ECAF0;
    text-decoration: underline;
}

.legal-article strong {
    color: var(--text-primary);
    font-weight: 600;
}

.legal-acknowledgment {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    color: var(--text-muted);
}

.legal-table-wrapper {
    overflow-x: auto;
    margin: 16px 0 24px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

.legal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.legal-table th,
.legal-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.legal-table th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legal-table td {
    color: var(--text-secondary);
}

.legal-table tr:last-child td {
    border-bottom: none;
}

.legal-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.legal-gradient-footer {
    position: fixed;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 250%;
    height: 350px;
    pointer-events: none;
    z-index: 0;
    border-radius: 60% 60% 0 0;
    background: radial-gradient(
        ellipse 70% 80% at 50% 100%,
        rgba(58, 175, 212, 0.35) 0%,
        rgba(58, 175, 212, 0.28) 15%,
        rgba(58, 175, 212, 0.22) 35%,
        rgba(58, 175, 212, 0.12) 55%,
        rgba(58, 175, 212, 0.04) 75%,
        transparent 100%
    );
}

@media (max-width: 768px) {
    .legal-header-content {
        padding: 12px 20px;
    }
    
    .legal-nav-left {
        gap: 20px;
    }
    
    .legal-nav-buttons {
        display: none;
        position: static;
        transform: none;
    }
    
    .legal-logo-img {
        height: 28px;
    }
    
    .try-deon-btn {
        padding: 8px 18px;
        font-size: 13px;
    }
    
    .legal-content {
        padding: 100px 24px 180px;
    }
    
    .legal-article {
        padding: 0;
    }
    
    .legal-article h1 {
        font-size: 28px;
    }
    
    .legal-article h2 {
        font-size: 20px;
    }
    
    .legal-article h3 {
        font-size: 16px;
    }
    
    .legal-table th,
    .legal-table td {
        padding: 10px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .legal-content {
        padding: 100px 18px 180px;
    }
    
    .legal-article h1 {
        font-size: 24px;
    }
    
    .legal-divider {
        margin: 24px 0;
    }
}

body.light-mode {
    --bg-primary: #E8ECF1;
    --bg-secondary: #DCE0E6;
    --text-primary: #1A1A1E;
    --text-secondary: #3D4550;
    --text-muted: #7E8795;
    --border-subtle: rgba(0, 0, 0, 0.1);
    --logo-filter: brightness(0) invert(0);
    background: #E8ECF1;
}

body.light-mode .legal-header {
    background: rgba(232, 236, 241, 0.9);
}

body.light-mode .legal-header::after {
    background: linear-gradient(
        to bottom,
        rgba(232, 236, 241, 0.9) 0%,
        rgba(232, 236, 241, 0.5) 30%,
        rgba(232, 236, 241, 0.2) 60%,
        transparent 100%
    );
}

body.light-mode .legal-article h1,
body.light-mode .legal-article h2,
body.light-mode .legal-article h3,
body.light-mode .legal-article strong {
    color: #1A1A1E;
}

body.light-mode .legal-article p,
body.light-mode .legal-article li {
    color: #3D4550;
}

body.light-mode .legal-date {
    color: #59616E;
}

body.light-mode .legal-divider {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-mode .legal-nav-btn {
    color: #59616E;
}

body.light-mode .legal-nav-btn:hover {
    color: #1A1A1E;
}

body.light-mode .legal-dropdown {
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
}

body.light-mode .legal-dropdown-name {
    color: #1A1A1E;
}

body.light-mode .legal-dropdown-email {
    color: #59616E;
}

body.light-mode .legal-dropdown-divider {
    background: rgba(0, 0, 0, 0.08);
}

body.light-mode .legal-dropdown-item {
    color: #59616E;
}

body.light-mode .legal-dropdown-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #1A1A1E;
}

body.light-mode .legal-dropdown-section-label {
    color: #7E8795;
}

body.light-mode .legal-nav-dropdown {
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
}

body.light-mode .legal-nav-dropdown-item {
    color: #59616E;
}

body.light-mode .legal-nav-dropdown-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #1A1A1E;
}

body.light-mode .try-deon-btn {
    color: #1A1A1E;
    background:
        linear-gradient(#E8ECF1, #E8ECF1) padding-box,
        linear-gradient(90deg, #3AAFD4, #5ECAF0, #3AAFD4) border-box;
}

body.light-mode .legal-table th {
    background: rgba(0, 0, 0, 0.03);
    color: #1A1A1E;
}

body.light-mode .legal-table td {
    color: #3D4550;
}

body.light-mode .legal-table tr:hover td {
    background: rgba(0, 0, 0, 0.02);
}

body.light-mode .legal-acknowledgment {
    color: #7E8795;
}

body.light-mode .legal-gradient-footer {
    background: radial-gradient(
        ellipse 70% 80% at 50% 100%,
        rgba(58, 175, 212, 0.15) 0%,
        rgba(58, 175, 212, 0.08) 35%,
        transparent 75%
    );
}
