.legal-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: linear-gradient(145deg, rgba(13, 14, 33, 0.95), rgba(13, 14, 33, 0.98));
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    z-index: 1001; /* Increased to be above the overlay */
    border: 1px solid rgba(0, 255, 157, 0.2);
    color: #FFFFFF;
    backdrop-filter: blur(10px);
}

.legal-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.legal-header {
    padding: 20px 25px;
    border-bottom: 1px solid rgba(0, 255, 157, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(13, 14, 33, 0.98);
    border-radius: 15px 15px 0 0;
}

.legal-header h2 {
    margin: 0;
    font-family: 'Orbitron', sans-serif;
    color: #00FF9D;
    font-size: 1.5em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.close-legal {
    background: none;
    border: none;
    color: #FFFFFF;
    cursor: pointer;
    font-size: 1.5em;
    padding: 5px;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-legal:hover {
    color: #00FF9D;
    background: rgba(0, 255, 157, 0.1);
}

.legal-content {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
    background: linear-gradient(145deg, rgba(13, 14, 33, 0.95), rgba(13, 14, 33, 0.98));
}

.legal-content h3 {
    color: #00FF9D;
    font-family: 'Orbitron', sans-serif;
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.legal-content p {
    margin-bottom: 20px;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.9);
}

.legal-content strong {
    color: #00FF9D;
    font-weight: 600;
}

.legal-content ul {
    list-style-type: none;
    padding-left: 25px;
    margin-bottom: 20px;
}

.legal-content li {
    margin-bottom: 12px;
    position: relative;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

.legal-content li:before {
    content: "•";
    color: #00FF9D;
    position: absolute;
    left: -20px;
    font-size: 1.2em;
}

/* Scrollbar styling */
.legal-content::-webkit-scrollbar {
    width: 8px;
}

.legal-content::-webkit-scrollbar-track {
    background: rgba(13, 14, 33, 0.98);
}

.legal-content::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 157, 0.3);
    border-radius: 4px;
}

.legal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 157, 0.5);
}

/* Page overlay for when modal is active */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 14, 33, 0.6);
    backdrop-filter: blur(0);
    opacity: 0;
    z-index: 999; /* Just below the modal */
    pointer-events: none;
    transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
    visibility: hidden;
}

body.modal-open::after {
    opacity: 1;
    backdrop-filter: blur(8px);
    pointer-events: auto;
    visibility: visible;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .legal-modal {
        width: 95%;
        max-height: 90vh;
        margin-top: 25px;
    }
    
    .legal-header {
        padding: 15px 20px;
    }
    
    .legal-header h2 {
        font-size: 1.3em;
    }
    
    .legal-content {
        padding: 20px;
    }
}
