/* --- Landing Screen Overlay --- */
.landing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #0a0a0f 0%, #000 100%);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 9999;
    backdrop-filter: blur(20px);
    transition: transform 0.8s cubic-bezier(0.85, 0, 0.15, 1), opacity 0.5s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.landing-overlay.fade-out {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.landing-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 100;
    pointer-events: auto;
    width: 100%;
    padding-top: 0;
    padding-bottom: 60px;
}

/* --- Visual Infrastructure --- */
#particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    opacity: 0.6;
}

.landing-visual-layers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.layer {
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background-size: cover;
    background-position: center;
    will-change: transform;
    transform: translateX(var(--x-offset, 0px)) translateY(var(--y-offset, 0px));
}

.layer-bg {
    background-image: radial-gradient(circle at center, rgba(138, 43, 226, 0.05) 0%, transparent 70%);
    filter: blur(30px);
    z-index: 1;
}

.layer-mid {
    background-image: 
        linear-gradient(rgba(0, 242, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 242, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 2;
}

.layer-fg {
    background: radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.4) 100%);
    z-index: 3;
}

.landing-logo {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    margin-top: -10px;
    margin-bottom: -80px; /* Optimized to reveal more text/buttons below the crest */
    z-index: 101;
    pointer-events: auto;
    cursor: crosshair;
    
    /* Edge Blending */
    -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 20%, transparent 95%);
    mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 20%, transparent 95%);
}

.landing-title {
    font-size: 42px;
    font-weight: 800;
    letter-spacing: 10px;
    background: linear-gradient(to right, var(--accent-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    text-shadow: 0 0 20px rgba(0, 242, 255, 0.3);
}

.landing-subtitle {
    font-size: 14px;
    letter-spacing: 4px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 20px;
}

.landing-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* --- Modal Base --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    padding: 40px;
    border: 1px solid var(--accent-cyan);
    box-shadow: 0 0 30px var(--glow-cyan);
}

#about-modal .modal-content {
    max-width: 1000px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 16px;
}

.modal-title {
    font-size: 20px;
    letter-spacing: 3px;
    color: var(--accent-cyan);
}

.modal-close {
    font-size: 24px;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--accent-pink);
    transform: rotate(90deg);
}

.modal-body {
    padding-top: 10px;
}

.modal-intro {
    font-size: 16px;
    color: white;
    font-weight: 600;
    margin-bottom: 30px;
    text-align: center;
}

.modal-footer-info {
    border-top: 1px solid var(--border-glass);
    padding-top: 20px;
    margin-top: 20px;
}

.modal-footer-info p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
}

.modal-footer-info i {
    color: var(--accent-purple);
    margin-right: 8px;
}

/* --- Magic Invite Portal --- */
.magic-portal {
    background: var(--surface-glass);
    backdrop-filter: blur(15px);
    border: 1px solid var(--accent-cyan);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    width: 320px;
    max-width: 95%;
    animation: slideInUp 0.5s ease-out;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px var(--glow-cyan);
    z-index: 102;
    transition: var(--transition);
}

.magic-portal.hidden {
    display: none;
}

/* --- Magic Terminal Sequence --- */
.magic-terminal {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(0, 242, 255, 0.3);
    border-radius: 4px;
    padding: 10px;
    height: 120px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 9px;
    color: var(--accent-cyan);
    text-align: left;
    position: relative;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 1);
}

.terminal-lines div {
    margin-bottom: 4px;
    line-height: 1.2;
}

.terminal-cursor {
    display: inline-block;
    animation: blink 1s step-end infinite;
}

.magic-portal.decryption-pulse {
    border-color: var(--accent-cyan) !important;
    box-shadow: 0 0 40px var(--glow-cyan), inset 0 0 20px var(--glow-cyan) !important;
    transform: scale(1.02);
}

@keyframes blink {
    from, to { opacity: 1; }
    50% { opacity: 0; }
}

.magic-portal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    color: var(--accent-cyan);
}

.magic-portal-header h3 {
    font-size: 14px;
    letter-spacing: 2px;
    font-weight: 700;
}

.magic-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 15px;
}

.magic-trigger {
    cursor: pointer;
    transition: var(--transition);
    display: inline-block;
    padding: 0 5px;
}

.magic-trigger:hover {
    color: var(--accent-cyan);
    text-shadow: 0 0 10px var(--glow-cyan);
    transform: translateY(-1px);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-field {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    margin-bottom: 5px;
    font-family: monospace;
}

.res-label {
    opacity: 0.5;
}

.res-value {
    font-weight: bold;
    word-break: break-all;
}

.error-active {
    animation: neon-pink-pulse 0.5s infinite alternate !important;
    border-color: var(--accent-pink) !important;
    box-shadow: 0 0 30px rgba(255, 0, 229, 0.6) !important;
}

@keyframes neon-pink-pulse {
    from {
        box-shadow: 0 0 10px rgba(255, 0, 229, 0.4);
        transform: scale(1);
    }
    to {
        box-shadow: 0 0 25px rgba(255, 0, 229, 0.8);
        transform: scale(1.01);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
