/* The draggable floating windows that show NekoWorld's five documents (see shared/legal.js), styled to sit on top of any
   NekoWorld site without leaving it. Dark glass to match every site; its own tokens, so no site's palette leaks in. */
#nw-legal-layer {
    --nwl-bg: rgba(14, 18, 40, 0.97);
    --nwl-fg: #eef1ff;
    --nwl-muted: rgba(238, 241, 255, 0.62);
    --nwl-edge: rgba(255, 255, 255, 0.14);
    --nwl-bar: rgba(255, 255, 255, 0.06);
    --nwl-accent: #b48bff;
    position: fixed;
    inset: 0;
    z-index: 9000;
    pointer-events: none;
}

.nw-legal-win {
    position: fixed;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    width: min(640px, calc(100vw - 24px));
    max-height: min(78vh, 760px);
    color: var(--nwl-fg);
    background: var(--nwl-bg);
    border: 1px solid var(--nwl-edge);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
    animation: nw-legal-in 0.16s ease both;
}

.nw-legal-win.dragging {
    animation: none;
    user-select: none;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}

.nw-legal-win.closing {
    animation: nw-legal-out 0.14s ease both;
}

@keyframes nw-legal-in {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

@keyframes nw-legal-out {
    to { opacity: 0; transform: translateY(6px) scale(0.98); }
}

.nw-legal-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 12px 18px;
    background: var(--nwl-bar);
    border-bottom: 1px solid var(--nwl-edge);
    cursor: grab;
    touch-action: none;
    flex: 0 0 auto;
}

.nw-legal-win.dragging .nw-legal-bar {
    cursor: grabbing;
}

.nw-legal-title {
    flex: 1 1 auto;
    font-weight: 800;
    font-size: 1.05rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nw-legal-close {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--nwl-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.nw-legal-close:hover,
.nw-legal-close:focus-visible {
    background: var(--nwl-edge);
    color: var(--nwl-fg);
}

.nw-legal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 6px 20px 20px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.nw-legal-body h2 {
    margin: 18px 0 6px;
    font-size: 1.3rem;
}

.nw-legal-body h3 {
    margin: 18px 0 4px;
    font-size: 1.02rem;
    color: var(--nwl-accent);
}

.nw-legal-body p {
    margin: 0 0 10px;
    line-height: 1.62;
}

.nw-legal-body section > section {
    margin-top: 6px;
}

.nw-legal-body a {
    color: var(--nwl-accent);
}

.nw-legal-body .switch {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid var(--nwl-edge);
    font-size: 0.92rem;
    color: var(--nwl-muted);
}

.nw-legal-dots {
    display: flex;
    gap: 7px;
    justify-content: center;
    padding: 46px 0;
}

.nw-legal-dots i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--nwl-accent);
    opacity: 0.4;
    animation: nw-legal-bounce 1s infinite ease-in-out;
}

.nw-legal-dots i:nth-child(2) { animation-delay: 0.15s; }
.nw-legal-dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes nw-legal-bounce {
    0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-7px); }
}

@media (max-width: 560px) {
    .nw-legal-win {
        width: calc(100vw - 16px);
        max-height: 82vh;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nw-legal-win,
    .nw-legal-win.closing,
    .nw-legal-dots i {
        animation: none;
    }
}
