/* Elite Zone gate — hide tool until check completes (no open-then-lock flash) */

body[data-elite-gate="true"]:not(.ma-elite-granted):not(.ma-elite-locked):not(.ma-elite-error) > *:not(#ma-elite-gate) {
    visibility: hidden;
    pointer-events: none;
}

body[data-elite-gate="true"].ma-elite-checking > *:not(#ma-elite-gate) {
    visibility: hidden;
    pointer-events: none;
}

body[data-elite-gate="true"].ma-elite-error > *:not(#ma-elite-gate) {
    visibility: hidden;
    pointer-events: none;
}

body[data-elite-gate="true"].ma-elite-granted > *:not(#ma-elite-gate) {
    visibility: visible;
    /* Do not force pointer-events: auto — pages use pass-through wrappers (e.g. planets-below-fold) */
}

body.ma-elite-checking {
    overflow: hidden;
}

.ma-elite-gate.ma-elite-gate--checking .ma-elite-gate__panel {
    border-color: rgba(212, 175, 55, 0.35);
}

.ma-elite-gate.ma-elite-gate--checking .ma-elite-gate__title::after {
    content: '';
    display: inline-block;
    width: 0.85em;
    height: 0.85em;
    margin-left: 0.45em;
    border: 2px solid rgba(212, 175, 55, 0.35);
    border-top-color: #d4af37;
    border-radius: 50%;
    vertical-align: middle;
    animation: maEliteSpin 0.75s linear infinite;
}

@keyframes maEliteSpin {
    to {
        transform: rotate(360deg);
    }
}

.ma-elite-gate.ma-elite-gate--checking #ma-elite-gate-return {
    display: none;
}

.ma-elite-gate.ma-elite-gate--error .ma-elite-gate__title {
    color: #e8c4a8;
}

/* Elite Zone locked preview — overlay only; does not replace page layout */

body.ma-elite-locked {
    overflow: hidden;
}

body.ma-elite-locked::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    background: rgba(4, 6, 9, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.ma-elite-gate {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.45s ease;
}

.ma-elite-gate.ma-elite-gate--visible {
    opacity: 1;
}

.ma-elite-gate.ma-elite-gate--ready .ma-elite-gate__panel {
    animation: maElitePanelIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes maElitePanelIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ma-elite-gate[hidden] {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

body.ma-elite-granted #ma-elite-gate[hidden] {
    display: none !important;
    pointer-events: none !important;
}

.ma-elite-gate__panel {
    width: 100%;
    max-width: 440px;
    padding: 1.75rem 1.5rem 1.5rem;
    border-radius: 16px;
    border: 1px solid rgba(212, 175, 55, 0.45);
    background: linear-gradient(165deg, rgba(18, 20, 28, 0.97), rgba(8, 10, 16, 0.98));
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.55),
        0 0 32px rgba(212, 175, 55, 0.12);
    text-align: center;
    color: #f2efe8;
}

.ma-elite-gate__badge {
    margin: 0 0 0.85rem;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(212, 188, 130, 0.85);
}

.ma-elite-gate__badge i {
    margin-right: 0.35rem;
}

.ma-elite-gate__title {
    margin: 0 0 0.65rem;
    font-size: 1.35rem;
    font-weight: 500;
    color: #f0d99a;
    line-height: 1.3;
}

.ma-elite-gate__body {
    margin: 0 0 1.25rem;
    font-size: 0.95rem;
    line-height: 1.55;
    color: rgba(242, 239, 232, 0.82);
}

.ma-elite-gate__actions {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.ma-elite-gate__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.ma-elite-gate__btn--primary,
#ma-elite-gate-return {
    border: 1px solid rgba(212, 175, 55, 0.55);
    background: linear-gradient(135deg, #d4af37, #b8922e);
    color: #1a1202;
}

.ma-elite-gate__btn--primary:hover {
    filter: brightness(1.06);
}

.ma-elite-gate__btn--ghost {
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(242, 239, 232, 0.9);
}

.ma-elite-gate__btn--ghost:hover {
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 480px) {
    .ma-elite-gate {
        padding: 1rem;
    }

    .ma-elite-gate__panel {
        max-width: 100%;
        padding: 1.35rem 1.1rem 1.2rem;
    }

    .ma-elite-gate__title {
        font-size: 1.2rem;
    }

    .ma-elite-gate__body {
        font-size: 0.88rem;
        line-height: 1.5;
        text-align: left;
    }

    .ma-elite-gate__btn {
        width: 100%;
    }
}
