.legal-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    padding: 30px;
    box-sizing: border-box;
    overflow-y: auto;
}

.legal-modal.active {
    display: flex;
}

.legal-modal-content {
    position: relative;
    background: linear-gradient(145deg, #2e1e13, #3c281c);
    border: 2px solid #a87a43;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.65), inset 0 0 6px rgba(0,0,0,0.35);
    max-width: 700px;
    width: 100%;
    max-height: calc(100dvh - 60px);
    margin: auto;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.legal-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    background: linear-gradient(180deg, #8b3a3a 0%, #723030 100%);
    border: 2px solid #a04545;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    margin: 0;
    color: #fff;
    font-size: var(--fs-h1);
    line-height: 1;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 0 #2d1b0d, 0 4px 8px rgba(0,0,0,0.6);
    overflow: hidden;
}

.legal-modal-close::before {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: 4px;
    background: linear-gradient(120deg,
        #a04545,
        #b05555,
        #8b3a3a,
        #a04545
    );
    background-size: 300% 300%;
    z-index: 0;
    animation: legalModalGlow 2s linear infinite;
    opacity: 0;
    transition: opacity .25s;
}

.legal-modal-close:hover::before {
    opacity: .5;
}

.legal-modal-close:hover {
    background: linear-gradient(180deg, #a04545 0%, #8b3a3a 100%);
    box-shadow: 0 3px 0 #2d1b0d, 0 5px 10px rgba(0,0,0,0.7);
}

.legal-modal-close:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #2d1b0d, 0 2px 4px rgba(0,0,0,0.5);
}

.legal-modal-close span {
    position: relative;
    z-index: 1;
}

.legal-modal-title {
    font-family: var(--font-main);
    font-size: var(--fs-h2);
    color: var(--title-color);
    margin: 0 0 20px;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

.legal-modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    font-family: var(--font-main);
    font-size: var(--fs-base);
    color: #e8d8c3;
    line-height: 1.6;
}

.legal-modal-body p {
    margin: 0 0 12px;
}

.legal-modal-body .legal-date {
    text-align: center;
    color: #a89070;
    font-size: var(--fs-small);
    margin-bottom: 16px;
}

.legal-modal-body h4 {
    font-family: var(--font-main);
    font-size: var(--fs-base);
    color: #d9b37e;
    margin: 20px 0 10px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.legal-modal-body h4:first-child,
.legal-modal-body .legal-date + h4 {
    margin-top: 0;
}

.legal-modal-body ol {
    margin: 0 0 12px;
    padding-left: 22px;
}

.legal-modal-body ol li {
    margin-bottom: 8px;
}

.legal-modal-body ul {
    margin: 6px 0 0;
    padding-left: 18px;
    list-style-type: disc;
}

.legal-modal-body ul li {
    margin-bottom: 4px;
}

@keyframes legalModalGlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

@media (max-width: 600px) {
    .legal-modal {
        padding: 20px;
    }

    .legal-modal-content {
        max-height: calc(100dvh - 40px);
    }
}
